akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  string a, b; cin >> a >> b;
  int n = stoi(a + b);
  if (sqrt(n) == int(sqrt(n))) Yes();
  else No();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 384
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:u32 = read();
    let a:Vec<u32> = (0..n).map(|_| read()).collect();
    let mut b = a.clone();
    b.sort();
    b.reverse();

    let mut cnt:u32 = 0;
    let mut mx:u32 = 0;
    for i in 0..n {
        let i = i as usize;
        if mx < a[i] {cnt=1; mx=a[i];}
        else if mx == a[i] {cnt+=1; mx=a[i];}
    }
    //println!("{}:{}", mx, cnt);
    for i in 0..n {
        let i = i as usize;
        if cnt > 1 {
            if a[i] == mx { println!("{}", a[i]) }
            else {println!("{}", mx)}
        } else {
            if a[i] == mx {println!("{}", b[1])}
            else {println!("{}", mx)}
        }
    }
}

Measured memory_bytes: 7676
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
	class Program
	{
		public static void Main()
		{
			var intArray = IO.ReadIntArray();
			var player0DeadCount = intArray[0] / intArray[3];
			if(intArray[0] % intArray[3] != 0) { ++ player0DeadCount; }
			var player1DeadCount = intArray[2] / intArray[1];
			if(intArray[2] % intArray[1] != 0) { ++ player1DeadCount; }
			IO.Write(player0DeadCount >= player1DeadCount);
		}
	}

	public static class IO
	{
		public static string   Read()								 { return Console.ReadLine(); }
		public static string[] ReadArray(char iSplitter = ' ')		 { return Read().Split(iSplitter); }
		public static int	   ReadInt()							 { return int.Parse(Read()); }
		public static int[]	   ReadIntArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => int.Parse(iText)).ToArray(); }
		public static long	   ReadLong()							 { return int.Parse(Read()); }
		public static long[]   ReadLongArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => long.Parse(iText)).ToArray(); }
		public static double   ReadDouble()							 { return double.Parse(Read()); }
		public static double[] ReadDoubleArray(char iSplitter = ' ') { return ReadArray().Select(iText => double.Parse(iText)).ToArray(); }
		public static char[]   ReadCharArray()						 { return Read().ToCharArray(); }

		public static void Write(string iValue)									   { Console.WriteLine(iValue); }
		public static void Write(int iValue)									   { Console.WriteLine(iValue); }
		public static void Write(IEnumerable<int> iValue , string iJoinWord = " ") { Console.WriteLine(string.Join(iJoinWord , iValue)); }
		public static void Write(long iValue)									   { Console.WriteLine(iValue); }
		public static void Write(double iValue)									   { Console.WriteLine(iValue); }
		public static void Write(decimal iValue)								   { Console.WriteLine(iValue); }
		public static void Write(bool iValue)									   { Console.WriteLine(iValue ? "Yes" : "No"); }
	}

	public static class Util
	{
		public static long Gcd(long i0 , long i1) { return (i0 > i1) ? _Gcd(i0 , i1) : _Gcd(i1 , i0); }
		public static long Lcm(long i0 , long i1) { return (i0 * i1) / Gcd(i0 , i1); }
		public static long ModPow(long iBaseNumber , long iPow , long iModNumber)
		{
			var num = 1L;
			while(iPow != 0)
			{
				if((iPow & 0x1) != 0)
				{
					num = (num * iBaseNumber) % iModNumber;
				}
				iBaseNumber = (iBaseNumber * iBaseNumber) % iModNumber;
				iPow >>= 1;
			}
			return num;
		}
		public static long CombinationNum(int iLeftNumber , int iRightNumber)
		{
			if(iRightNumber == 0) { return 1; }
			if(iLeftNumber == 0)  { return 0; }
			return iLeftNumber * CombinationNum(iLeftNumber - 1 , iRightNumber - 1) / iRightNumber;
		}

		private static long _Gcd(long i0 , long i1)	{ return (i1 == 0) ? i0 : _Gcd(i1 , i0 % i1); }
	}
}


Measured memory_bytes: 28000
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;
  vi e(n + 1), w(n + 1);
  for(int i = 1; i <= n; i++){
    if(s[i - 1] == 'E') e[i] = 1;
    e[i] += e[i - 1];
    if(s[i - 1] == 'W') w[i] = 1;
    w[i] += w[i - 1];
  }
  int ans = n;
  for(int i = 1; i <= n; i++){
    if(s[i - 1] == 'E'){
      ans = min(ans, w[i] + e[n] - e[i]);
    }else{
      ans = min(ans, w[i - 1] + e[n] - e[i]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const int N=2e6+20;
const ll inf=2e15;
ll n,m,num;
map<ll,ll> mp[N];
vector<ii> e[N];
ll inq[N],d[N];
queue<int> q;
int getid(int u,int c)
{
	if(mp[u][c]==0)
		mp[u][c]=++num;
	return mp[u][c];
}

void SPFA(int s,int t)
{
	for(int i=1;i<=num;i++)
		d[i]=inf,inq[i]=0;
	q.push(s);
	d[s]=0,inq[s]=1;
	while(!q.empty())
	{
		int u=q.front();
		q.pop(),inq[u]=0;
		for(int i=0;i<e[u].size();i++)
		{
			int v=e[u][i].first,w=e[u][i].second;
			if(d[v]>d[u]+w)
			{
				d[v]=d[u]+w;
				if(!inq[v])
					inq[v]=1,q.push(v);
			}
		}
	}
	printf("%lld\n",d[t]>=inf?-1:d[t]/2);
}
int main()
{
	while(cin>>n>>m)
	{
		for(int i=0;i<=n;i++)
			e[i].clear();
		int u,v,c;
		num=n;
		while(m--)
		{
			scanf("%d%d%d",&u,&v,&c);
			int uc=getid(u,c);
			int vc=getid(v,c);
			e[u].push_back(ii(uc,1));
			e[uc].push_back(ii(u,1));
			e[v].push_back(ii(vc,1));
			e[vc].push_back(ii(v,1));
			
			e[uc].push_back(ii(vc,0));
			e[vc].push_back(ii(uc,0));		
		}
		SPFA(1,n);
		
		for(int i=0;i<=num;i++)
			mp[i].clear();
	}
	return 0;
}

Measured memory_bytes: 205696
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
using namespace std;

int main() {
    string str, brackets = "()[]";
    while (getline(cin, str) && str != ".") {
        stack<char> s;
        bool flag = true;
        for (int i = 0; i < str.length(); i++) {
            if (brackets.find(str[i]) != string::npos) {
                if (str[i] == '(' || str[i] == '[') s.push(str[i]);
                if (str[i] == ')') {
                    if (s.empty()) { flag = false; break; }
                    char ch = s.top(); s.pop();
                    if (ch == '[') { flag = false; break; }
                }
                if (str[i] == ']') {
                    if (s.empty()) { flag = false; break; }
                    char ch = s.top(); s.pop();
                    if (ch == '(') { flag = false; break; }
                }
            }
        }
        if (!s.empty()) flag = false;
        cout << (flag ? "yes" : "no") << endl;
    }
    return 0;
}


Measured memory_bytes: 3156
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

k = 1
p = False
for i in range(n):
    if a[k-1] == 2:
        print(i+1)
        p = True
        break
    k = a[k-1]
if not p:
    print(-1)


Measured memory_bytes: 49240
#define ENABLE_DEBUG 1
// hidden common codes{{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(lint ngtkana_is_a_genius=0; ngtkana_is_a_genius<(lint)k; ngtkana_is_a_genius++)
using lint=long long;
using ld=long double;
template<class T> using numr=std::numeric_limits<T>;
struct input_t {
    template<class T> operator T() {
        T t;
        std::cin>>t;
        return t;
    }
} input;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    lint x=input;
    lint ans=0;
    lint now=100;
    while(now<x){
        now=now + now/100;
        ans++;
    }
    std::cout<<ans<<'\n';
}


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

int main(){
  ll N,M,i;
  map<ll,ll> mll;
  cin>>N>>M;
  ll a[N];
  for(i=0;i<N;i++) cin>>a[i];
  ll b[N+1];
  b[0]=0;
  for(i=1;i<=N;i++) b[i]=(b[i-1]+a[i-1])%M;
  for(i=0;i<=N;i++){
	if(mll.count(b[i])==0) mll[b[i]]=1;
	else mll[b[i]]+=1;
  }
  ll ans=0;
  for(map<ll,ll>::iterator it=mll.begin();it!=mll.end();++it){
	ans+=(*it).second*((*it).second-1)/2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5760
#include<iostream>
#define mod 1000000007
#define ll long long
using namespace std;
ll dp[3005][3005];
ll pdp[3005][3005];
int n;
string s;
int main()
{
	cin>>n;
	cin>>s;	
	for(int i=01;i<=n;i++){dp[1][1]=1;pdp[1][i]=1;}
	for(int i=2;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(s[i-2]=='<')dp[i][j]=pdp[i-1][j-1];
			else dp[i][j]=(pdp[i-1][n]-pdp[i-1][j-1]+mod)%mod;
			if(j>i)dp[i][j]=0;
			pdp[i][j]=(pdp[i][j-1]+dp[i][j])%mod;
		}
	}
	cout<<pdp[n][n];
}

Measured memory_bytes: 141184
#include<bits/stdc++.h>
#define maxn 400010
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define rep(x,a,b) for(int x=a;x<=b;x++)
#define per(x,a,b) for(int x=a;x>=b;x--)
using namespace std;

int a[maxn],n,k;
vector<int> v;
set<int> st;
queue<int> q;
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>k;
	printf("%d\n",n%k>0);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int64_t n, a, b; cin >> n >> a >> b;
	if(abs(b - a) % 2 == 0) {
		cout << abs(b - a) / 2 << '\n';
	} else {
		int64_t ans = LINF;
		ans = min(ans, (a + 1) + abs(b - (a + 1) - 1) / 2);
		cerr << ans << '\n';
		ans = min(ans, (n - b + 1) + abs(n - (a + (n - b + 1))) / 2);
		// cerr << ans << '\n';

		int64_t l = b - 1;
		int64_t r = n - a;
		if(a + 1 == b) {
			ans = min(ans, min(l, r));
		} else {
			l--;
			r--;
			ans = min(ans, min(l, r));
		}
		cout << ans << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a;
    cin>>a;
    vector<int > v1,v2;
    for(int i=0;i<a;i++)
    {
        int t;
        cin>>t;
        v1.push_back(t);
    }
    cin>>a;
    for(int i=0;i<a;i++)
    {
        int t;
        cin>>t;
        v2.push_back(t);
    }
    if(includes(v1.begin(),v1.end(),v2.begin(),v2.end()))
    {
        cout<<1<<endl;
    }
    else cout<<0<<endl;
}


Measured memory_bytes: 5160
n = int(input())
l = []
for i in range(n):
    d = int(input())
    l.append(d)
# print(l)
ans = 0
com = 0
l.sort(reverse=True)
for j in l:
    if j < com:
        ans += 1
        com = j
    elif j > com:
        ans = 1
        com = j
    # print(ans, com)

print(ans)    

Measured memory_bytes: 38384
package main

import (
	"fmt"
)

func pow(x, n, mod int64) int64 {
	if n == 0 {
		return 1
	}
	xx := x * x % mod
	r := pow(xx, n/2, mod)
	if n%2 == 1 {
		r = x * r % mod
	}
	return r
}

const mod = 1e9 + 7

func main() {
	var n int
	fmt.Scan(&n)
	var a []int
	for i := 0; i < n; i++ {
		var t int
		fmt.Scan(&t)
		a = append(a, t)
	}
	t := make([]int, n+1)
	var b []int
	for i := n; i > 0; i-- {
		k := 0
		for j := k; j <= n; j += i {
			k += t[j]
		}
		if k%2 != a[i-1] {
			t[i] = 1
			b = append(b, i)
		}
	}
	bl := len(b)
	fmt.Println(bl)
	for i := 0; i < bl; i++ {
		if i == bl-1 {
			fmt.Printf("%d\n", b[i])
		} else {
			fmt.Printf("%d ", b[i])
		}
	}
}


Measured memory_bytes: 10112
#include<cstdio>
using namespace std;
int main()
{
  int a,b;
  scanf("%d%d",&a,&b);
  if(a%3==0||b%3==0||(a+b)%3==0)
  {
    printf("Possible");
  }else
  {
    printf("Impossible");
  }
}

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

int main() {
    int n, count = 0;

    cin >> n;

    int n4 = n / 1000,
    n3 = n % 1000 / 100,
    n2 = n % 100 / 10,
    n1 = n % 10;

    if (n2 == n3 && (n2 == n1 || n3 == n4))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}

void solve(){
    int n,m;
    cin >> n >> m;
    int i = 1;
    if(n%2)while(m > 0){
        cout << i << " " << n-i << "\n";
        i++;
        m--;
    }
    else {
       set<int>diff;
       int j = n;
       while(m > 0){
            if(diff.find(j-i) == diff.end() && j-i != n/2){
                diff.insert(j-i);
                diff.insert(n-j+i);
                cout << i << " " << j << "\n";
                i++;
                j--;
                m--;
            }
            else j--;
       }
    }
}

signed main()   
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){
        solve();
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...


Measured memory_bytes: 9940
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

#define MAX 1001
const char INF = '#';
const int MM = 10000000;
typedef pair<int,int> P;
 
int num,d[MAX][MAX],n,m;
int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
char field[MAX+1][MAX+1];
 
int bfs(int sy,int sx,int gy,int gx){
    queue<P> que;
    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < m ; j++){
            d[i][j] = MM;
	}
    }
     
    que.push(P(sy,sx));
    d[sy][sx] = 0;
     
    while(que.size()){
        P p = que.front(); que.pop();
        if(p.first == gy && p.second == gx) break;
         
        for(int i = 0 ; i < 4 ; i++){
            int nx = p.first+dx[i];
            int ny = p.second+dy[i];
             
            if(0 <= nx && nx < n && 0 <= ny && ny < m && field[nx][ny] != 'X'
               &&d[nx][ny] == MM){
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second]+1;
            }
        }
    }
     
    return d[gy][gx];
}
 
int main(){
    fill(field[0],field[MAX],INF);
 
    cin >> n >> m >> num;
    vector<P> v(num+1);
    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < m ; j++){
            cin >> field[i][j];
            if(field[i][j]=='S'){
                v[0].first = i;
                v[0].second = j;
            }
            if('0' <= field[i][j] && field[i][j] <= '9'){
                v[field[i][j]-'0'].first = i;
                v[field[i][j]-'0'].second = j;
            }
        }
    }
 
    int ans = 0;
    for(int i = 1 ; i < num+1 ; i++){
        ans += bfs(v[i-1].first,v[i-1].second,v[i].first,v[i].second);
    }
    cout << ans << endl;
 
    return 0;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;

void run_case()
{
    int n;
    cin >> n;
    vector<int> B(n), A(n + 1);
    for (int i = 1; i <= n - 1; i++)
        cin >> B[i];
    int ans = 0;
    A[1] = B[1], A[n] = B[n - 1];
    ans += (A[1] + A[n]);
    for (int i = 2; i <= n - 1; i++)
    {
        A[i] = min(B[i - 1], B[i]);
        ans += A[i];
    }
    cout << ans << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3628
N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(p*p < 55555):
  p = lis.pop(0)
  if p%5==1:primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
while(len(primes)<=56):
  p = lis.pop(0)
  if p%5==1:primes.append(p)

print(' '.join(map(str, primes[:N])))


Measured memory_bytes: 43796
#include<iostream>
#include<cmath>

using namespace std;

int main(){
	int a[5];
	for(int i=0;i<5;i++)cin>>a[i];
	int ans =0;
	int ma =0;
	for(int i=0;i<5;i++){
		ans += a[i];
		if(a[i]%10){
			ma = max(ma,10-a[i]%10);
			ans += (10-a[i]%10);
		}
	}
	cout<<ans-ma<<endl;
	return 0;
}

Measured memory_bytes: 256
#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,k;
	cin >> n >> k;
	
	vector<int> table;
	int tmp = 1;
	while(true){
		table.push_back(tmp);
		if(tmp >= k) break;
		tmp <<= 1;
	}
	
	int p = 0;
	int init = n;
	
	double res = 0;
	while(init > 0){
		while(init * table[p] < k){
			p++;
		}
		
		res += pow(0.5, p);
		init--;
	}
	
	res /= n;
	printf("%.9f", res);
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long n,k,i,a[200005],total=0,j;
    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+n,greater<long long>());
    for(j=k+1;j<=n;j++)
    {
        total+=a[j];
    }
    cout<<total<<endl;
    return 0;    
}

Measured memory_bytes: 5136
//
//  main.cpp
//  1234
//
//  Created by Moha Jain on 14/04/20.
//  Copyright © 2020 Moha Jain. All rights reserved.
//

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<stack>
#include<algorithm>
#include<string>
#include<math.h>
#include <iomanip>
using namespace std;

int main()
{
   long long int n,m;cin>>n>>m;
   long long int a,i,sum=0;for(i=0;i<m;i=i+1){cin>>a;sum=sum+a;}
    if(sum>n){cout<<-1<<endl;}
    else{cout<<(n-sum)<<endl;}
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b,c;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}

#define MAXSIZE 200000
int list[MAXSIZE];
int tail;

void Init(void){
    tail=0;
}
int Top(void){
    return 0;
}

int Next(int pos){
    if(pos<tail-1){
        return pos+1;
    }else{
        return -1;
    }
}
int Count(void){
    return tail;
}

int Item(int pos){
    if((pos>=0)&&(pos<tail)){
        return list[pos];
    }else{
        return 0;
    }
}
void Add(int value){
    if(tail<MAXSIZE){
        list[tail]=value;
        tail++;
    }
}
void Delete(int pos){
    if((pos>=0)&&(pos<tail)){
        int i;
        for(i=pos;i<tail-1;i++){
            list[i]=list[i+1];
        }
        tail--;
    }
}
int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    char row[11];
    int min=100000;
    scanf("%s",row);
    for(int i=0;i<(int)strlen(row)-2;i++){
        int temp=0;
        temp=100*(int)(row[i]-'0')+10*(int)(row[i+1]-'0')+(int)(row[i+2]-'0');
        if(min>abs(temp-753)){
            min=abs(temp-753);
        }else{
            ;
        }
    }
    printf("%d",min);
}



Measured memory_bytes: 1688
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,X,Y;
    long long ans=1LL<<60;
    cin>>A>>B>>C>>X>>Y;
    for(int i=0;i<=max(X,Y);i++)
	ans=min(ans,1LL*i*C*2+1LL*A*max(0,X-i)+1LL*B*max(0,Y-i));
    cout<<ans;
    return 0;
}

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

int main(void) {
  string s,t;
  cin >> s >> t;

  int n = s.size();
  map<char,int> sm, tm;
  vector<int> sv, tv;
  for (int i = 0; i < n; i++) {
    if(sm.find(s[i]) == sm.end()) {
      sm.insert(make_pair(s[i], 1));
    } else {
      sm[s[i]] = sm[s[i]]+1;
    }
    
    if(tm.find(t[i]) == tm.end()) {
      tm.insert(make_pair(t[i], 1));
    } else {
      tm[t[i]] = tm[t[i]]+1;
    }
  }

  for (char c = 'a'; c <= 'z'; c++) {
    sv.push_back(sm[c]);
    tv.push_back(tm[c]);
  }

  sort(sv.begin(), sv.end());
  sort(tv.begin(), tv.end());

  if(sv == tv){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    rep(i, n) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    int ans = A[A.size() - 1] - A[0];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

//C++17
template<typename Type>
Type GCD(Type a,Type b){ return b ? GCD(b,a%b) : a ;}
template<typename Type>
Type LCM(Type a,Type b){ return a*b / GCD(a,b) ;}

template<typename Type>//文字列の置換/Boost:replace_all()
Type replace_str(Type str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main() {
    int n,m;cin >> n >> m;
    vector<int> a(n+1);
    rep(i,m){
        int t;cin >> t;
        a[t] = 1;
    }
    vector<ll> dp(n+1);
    dp[0] = 1;
    if(a[1]==0)dp[1] = 1;
    for(int i=2;i<=n;i++){
        if(a[i]==0){
            dp[i] = dp[i-1] + dp[i-2];
            dp[i] %= MOD;
        }
    }
    cout << dp[n]%MOD << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int count = 0;
  int max = 0;
  for(int i = 0;i<s.size();i++){
    count=0;
    if(s[i] == 'A'){
        for(int j = s.size()-1;0<j;j--){
            if(s[j] == 'Z') {
                count = j - i+1;
                break; 
            }
        }
    }
    if(max < count) max = count;
  }
  cout << max << endl;
}

Measured memory_bytes: 3752
#include <string>
#include <vector>
#include <map>
#include <iostream>
#define ll long long
using namespace std;

int main() {
    ll A,B,C;
    cin>>A>>B>>C;
    
    
    // A+B and C.
    
    ll x = min(C,A+B)+B;
    
    ll left = C-min(C,A+B);
    
    cout << x + min(left, 1ll) << endl;
    
    
    
    
    
    
    
    
}

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

struct	UnionFind {
	int		size;
	int		*par;
	int		*rank;
	UnionFind(int size): size(size), par(NULL), rank(NULL) {
		assert(size > 0);
		par = new int[size];
		rank = new int[size];
		assert(par != NULL && rank != NULL);
		for (int i = 0; i < size; ++i) {
			par[i] = i;
			rank[i] = 0;
		}
	}
	~UnionFind() {
		delete [] par;
		delete [] rank;
		par = NULL;
		rank = NULL;
	}
	int		find(int idx) {
		if (par[idx] == idx)
			return idx;
		return (par[idx] = find(par[idx]));
	}
	bool	same(int lhs, int rhs) {
		if (find(lhs) == find(rhs))
			return true;
		return false;
	}
	void	unite(int lhs, int rhs) {
		int	par_l = find(lhs), par_r = find(rhs);
		if (par_l == par_r)
			return;
		if (rank[par_l] < rank[par_r]) {
			par[par_l] = par_r;
		} else {
			par[par_r] = par_l;
			if (rank[par_l] == rank[par_r])
				++rank[par_l];
		}
	}
};

int	main()
{
	int	n, q;
	cin >> n >> q;
	UnionFind	uf(n);
	int	com, x, y;
	for (int i = 0; i < q; ++i) {
		cin >> com >> x >> y;
		if (com == 0)
			uf.unite(x, y);
		if (com == 1) {
			if(uf.same(x, y))
				cout << 1 << endl;
			else
				cout << 0 << endl;
		}
	}
}



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

#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
#define nrep(i,a,b) for(int i=int(a);i>=int(b);--i)
#define trv(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define watch(x) cout<<"\n"<<#x<<" is "<<x<<"\n"
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define ZERO(box) memset(box, 0, sizeof(box));
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define chkbit(s, b) (s & (1<<b))
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1e9+7;

bool is_good(int n,vi &d){
	while(n){
		int dig = n%10;
		if(d[dig]==0) return 0;
		n/=10;
	}
	return 1;
}

void solve(){
	int n,k;
	cin>>n>>k;
	vi d(10,1);
	int p;
	rep(i,1,k){
		cin>>p;
		d[p]=0;
	}
	p = n;
	while(!is_good(n,d)) n++;

	cout<<n;
}


int main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();	
	}	
}
/*input
1000 8
1 3 4 5 6 7 8 9
*/

Measured memory_bytes: 256
n=int(input())
h=[int(i) for i in input().split()]

a=[0]*n
a[1]=abs(h[0]-h[1])
for i in range(0,n-2):
    a[i+2]=a[i]+ abs(h[i+2]-h[i])
    a[i+1]=min(a[i+1] , a[i]+ abs(h[i+1]-h[i]))
a[n-1] = min(a[n-1] , a[n-2]+ abs(h[n-1]-h[n-2]))
print(a[-1])

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

//#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n, m, t; cin >> n >> m >> t; vector<int>v(n); rep(i, 0, n)cin >> v[i];
	int ans = 0, idx = 0;
	dump(ans);
	ans += v[0] - m;
	dump(ans);
	rep(i, 0, n - 1) {
		ans += max(0, v[i + 1] - v[i] - 2 * m);
		dump(ans);
	}
	ans += max(0, t - v[n - 1] - m);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3092
import java.util.Scanner;
public class Main {
  public static double distance(double x1, double y1, double x2, double y2) {
    return Math.pow(Math.pow((x2 - x1), 2) + Math.pow(y2 - y1, 2), .5);
  }
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    double x1 = s.nextDouble();
    double y1 = s.nextDouble();
    double x2 = s.nextDouble();
    double y2 = s.nextDouble();
    System.out.println(distance(x1, y1, x2, y2));
    s.close();
  }
}



Measured memory_bytes: 28040
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long sum = 0;
    double btc = 0;
    int n = sc.nextInt();
    for(int i = 0; i < n; i++){
      double tmp = sc.nextDouble();
      String str = sc.next();
      if(str.equals("JPY")){
        sum += (long)(tmp);
      }else{
        btc += tmp;
      }
    }
    System.out.println(btc * 380000.0 + sum);
  }
}

Measured memory_bytes: 24660
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	int n,a;cin>>n>>a;
	if(n%500>a) cout<<"No"<<endl;else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <deque>
using namespace std;
using P = pair<int,int>;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
    int n,d;
    cin >> n >> d;
    vector<vector<int>>x(n,vector<int>(d));
    rep(i,n){
        rep(j,d){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    rep(i,n){
         for(int j=i+1; j<n; j++){
             int norm = 0;
             rep(k,d){
                 int diff = abs(x[i][k] - x[j][k]);
                 norm += diff * diff;
             }
             bool flag = false;
             for(int k = 0; k<=norm; k++){
                 if(k*k==norm){
                     flag = true;
                 }
             }
             if(flag)ans++;
         }
    }
    cout << ans << endl;
    return 0;
}




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

int main(){
    string s;
    cin >> s;
    if(s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

Measured memory_bytes: 3628
import sys

def main():
    input = sys.stdin.readline
    U = [str(c) for c in input().strip()]
    D = [str(c) for c in input().strip()]

    if U[0] == D[2] and U[1] == D[1] and U[2] == D[0]:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int n,m,l,k,a,h;
bool R[100];
int dis[100][101];
main()
{
	while(cin>>n>>m>>l>>k>>a>>h,n)
	{
		for(int i=0;i<n;i++)R[i]=0;
		for(int i=0;i<l;i++)
		{
			int u;cin>>u;R[u]=1;
		}
		vector<vector<pair<int,int> > >G(n);
		for(int i=0;i<k;i++)
		{
			int u,v,c;cin>>u>>v>>c;
			G[u].push_back(make_pair(v,c));
			G[v].push_back(make_pair(u,c));
		}
		for(int i=0;i<n;i++)for(int j=0;j<=m;j++)dis[i][j]=1e9;
		dis[a][m]=0;
		priority_queue<pair<int,pair<int,int> > >P;
		P.push(make_pair(0,make_pair(a,m)));
		while(!P.empty())
		{
			int c=-P.top().first;
			int u=P.top().second.first,L=P.top().second.second;
			P.pop();
			if(dis[u][L]<c)continue;
			for(int i=L;i<=(R[u]?m:L);i++)
			{
				for(int j=0;j<G[u].size();j++)
				{
					if(i<G[u][j].second)continue;
					int v=G[u][j].first;
					int cost=G[u][j].second;
					if(dis[v][i-cost]>c+(i-L)+cost)
					{
						dis[v][i-cost]=c+(i-L)+cost;
						P.push(make_pair(-dis[v][i-cost],make_pair(v,i-cost)));
					}
				}
			}
		}
		int ans=1e9;
		for(int i=0;i<=m;i++)ans=min(ans,dis[h][i]);
		if(ans<1e9)cout<<ans<<endl;
		else cout<<"Help!"<<endl;
	}
}



Measured memory_bytes: 3368
#include<bits/stdc++.h>
using namespace std;
long long a[100005],b[100005];
priority_queue<long long>q;
int main(){
	int n,t=0;
	long long sa=0,sb=0;
	long long now;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i],sa+=a[i];
	for(int i=1;i<=n;i++)
		cin>>b[i],sb+=b[i];
	if(sa<sb)
	{
		cout<<-1;
		return 0;
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i])
		now+=a[i]-b[i],t++;
		else
		q.push(a[i]-b[i]);
	}
	while(!q.empty()){
		long long tmp=q.top();
		q.pop();
		if(now<0)
		{
			now+=tmp;
			t++;
		}
		else
		break;
	}
	cout<<t;
}

Measured memory_bytes: 2808
using System;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().ToCharArray();
            var a = int.Parse(_[0].ToString());
            var b = int.Parse(_[1].ToString());
            var c = int.Parse(_[2].ToString());
            var d = int.Parse(_[3].ToString());

            var op = new string[]{"+", "-"};
            for(var i = 0; i < 2; i++){
                for(var j = 0; j < 2; j++){
                    for(var k = 0; k < 2; k++){
                        var x = Calc(a, b, op[i]);
                        var y = Calc(x, c, op[j]);                        
                        var z = Calc(y, d, op[k]);   

                        if(z == 7){
                            Console.WriteLine(
                                string.Format("{0}{1}{2}{3}{4}{5}{6}=7"
                                ,a,op[i],b,op[j],c,op[k],d));
                                return;
                        }                     
                    }
                }
            }
        }

        static int Calc(int x, int y, string op){
            if(op.Equals("+")){
                return x + y;
            }else{
                return x - y;
            }
        }
    }
}


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

int main() {
  int x,t;
  cin >> x >>t;
  if(t >= x) cout << 0 << endl;
  else cout << x-t << endl;
}

Measured memory_bytes: 3500
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e2 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N][N];
 
signed main() {
	IOS;
	#ifdef LOCAL
		freopen("input.txt","r", stdin);
		freopen("output.txt","w",stdout);
	#endif
	int n, d;
	cin >> n >> d;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= d; j++)
			cin >> a[i][j];
	}	
	int ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = i+1; j <= n; j++){
			int x = 0;
			for(int k = 1; k <= d; k++)
				x += (a[i][k] - a[j][k])*(a[i][k] - a[j][k]);
			int p = sqrt(x);
			if(p*p == x)
				ans++;
		}	
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env pypy3

import itertools


class UnionFind(object):

    def __init__(self, number_of_nodes):
        self.par = list(range(number_of_nodes))
        self.rank = [0] * number_of_nodes

    def root(self, node):
        if self.par[node] == node:
            return node
        else:
            r = self.root(self.par[node])
            self.par[node] = r
            return r

    def in_the_same_set(self, node1, node2):
        return self.root(node1) == self.root(node2)

    def unite(self, node1, node2):
        x = self.root(node1)
        y = self.root(node2)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1


def count_bridges(n, m, edges):
    res = 0
    for rem_idx in range(m):
        uf = UnionFind(n)
        for i in range(m):
            if i != rem_idx:
                a, b = edges[i]
                uf.unite(a, b)
        for u, v in itertools.product(range(n), repeat=2):
            if not uf.in_the_same_set(u, v):
                res += 1
                break
    return res


def main():
    n, m = (int(x) for x in input().split())
    edges = [tuple(int(x) - 1 for x in input().split()) for _ in range(m)]
    print(count_bridges(n, m, edges))


if __name__ == '__main__':
    main()


Measured memory_bytes: 44652
#include<iostream>
using namespace std;
void insertionSort(int arr[],int n);
int main() {
    int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;++i){
        cin>>a[i];
	}
    for(int i=0;i<n-1;i++){
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
  insertionSort(a,n);

  return 0;
}
void insertionSort(int arr[],int n)
{
	int i,j,key;
	for (i=1;i<=n-1;i++)
	{
		key=arr[i];
		j=i-1;
 		while (j>=0&&arr[j]>key)
 		{
 			arr[j+1]=arr[j];
 			j--;
 		}
 		arr[j+1]=key;

 		for(int k=0;k<n-1;k++){
            cout<<arr[k]<<" ";
 		}
 		cout<<arr[n-1]<<endl;
	}
}



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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000;
const ll LINF = (ll) 4000000000000000000;
const ll MOD = (ll) 1000000007;
const double PI = acos(1.0);
const int limit = 100010;

#define REP(i,m,n) for(int i = (int)m; i < (int)n; i++)
#define rep(i,n) REP(i,0,n)
#define rep2(i,n) REP(i,1,n+1)
#define rep3(i,n) REP(i,0,n+1)
#define REPM(i,m,n) for(int i = (int)m; i >= (int)n; i--)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define repll(i,n) REPLL(i,0,n)
#define repll2(i,n) REPLL(i,1,n+1)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define Size(s) (int) s.size()
#define smaller_queue  priority_queue <ll, vector<ll>, greater<ll> >

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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;

    int Max = 0;

    REP(cut, 1, n) {
        map<char, bool> mp_x, mp_y;

        rep(i, n) {
            if (i < cut) {
                mp_x[s[i]] = true;
            } else {
                mp_y[s[i]] = true;
            }
        }

        int cnt = 0;

        rep(i, 26) {
            char c = (char) (i + 'a');
            if (mp_x[c] && mp_y[c]) cnt++;
        }

        Max = max(Max, cnt);
    }

    cout << Max << endl;

    return 0;
}


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

int main() {
    long long N;
    cin >> N; 
    string S = to_string(N);
    int M=0;
    for (int i=0; i<S.size(); i++) M+=(S.at(i)-'0');
    if (N%M==0) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    ll a, b, m;
    cin >> a >> b >> m;
    vector<ll> as(a), bs(b);
    ll min_a = 100001;
    ll min_b = 100001;
    rep(i, a) {
        ll tmp;
        cin >> tmp;
        as[i] = tmp;
        min_a = min(min_a, tmp);
    }
    rep(i, b) {
        ll tmp;
        cin >> tmp;
        bs[i] = tmp;
        min_b = min(min_b, tmp);
    }

    ll res = min_a + min_b;
    rep(i, m){
        ll x, y, c;
        cin >> x >> y >> c;
        --x;
        --y;
        res = min(as[x]+bs[y]-c, res);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
typedef long long ll;

int main(){
    string s;
    ll k;
    cin >> s >> k;
    for(ll i = 0; i < k; i++){
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << 1 << endl;

    return 0;
}


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

long long a, b, x;

int main () {
  cin >> a >> b >> x;
  
  if (a == 0) {
    cout << b/x + 1 << endl;
  }
  else if (a%x == 0){
    cout << b/x - a/x +1 << endl;
  }else{
    cout << b/x - a/x << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000;

signed main(){
  int N, K;
  cin >> N >> K;
  
  vector<int> H(N+500);
  for( int i = 0; i < N; i++ ) cin >> H.at(i);
  
  vector<int> dp(N+200, INF);
  dp.at(0) = 0;
  
  for( int i = 0; i < N; i++ ){
    for( int j = 1; j <= K; j++ ){
      dp.at(i+j) = min( dp.at(i+j), dp.at(i)+abs(H.at(i)-H.at(i+j)) );
    }
  }
  cout << dp.at(N-1) << endl;
  
}

Measured memory_bytes: 1792
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    { 
        int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = l[0];
        int m = l[1];

        double ans = (1900 * m + 100 * (n - m)) * Math.Pow(2, m);
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13396
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1000000000100000000;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
  int n, k; cin >> n >> k;
    ll zero = 0, half = 0;
    rept(i, 1, n+1){
      if(i%k==0)zero++;
      else if(k%2==0 && i%k==k/2)half++;
    }
    ll res = pow(zero, 3) + pow(half, 3);
    cout << res << ln;
}

Measured memory_bytes: 3592
#include <iostream>

using namespace std;

int main()
{
    int counter=0;
    char A[5]={'a','e','o','i','u'};
    char c;
    cin >> c;
    for (int i=0; i<5; i++){
        if (c==A[i]){
            counter+=1;
        }
    }
    if (counter==1){
        cout << "vowel";
    }
    else {
        cout << "consonant";
    }

    return 0;
}



Measured memory_bytes: 256
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define LOG
#define PRINT
#define LCERR

#include <iostream>

auto optimize_cpp_stdio = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ);
    return 0;
}();
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:
    int streamline(const int N, vector<int>& targets) {
        if (targets.empty()) return 0;
        if (N >= targets.size()) return 0;

        vector<int> gaps;
        sort(targets.begin(), targets.end());
        for (int i = 0; i + 1 < targets.size(); ++i) {
            gaps.emplace_back(targets[i + 1] - targets[i]);
        }
        sort(gaps.begin(), gaps.end());
        int moves = targets.back() - targets[0];
        for (int i = 0; i < N - 1; ++i) {
            moves -= gaps.back();
            gaps.pop_back();
        }
        return moves;
    }

private:

};

int solve() {
    Solution solution;
    // handle IO here
    int N, M;
    cin >> N >> M;
    vector<int> targets(M);
    for (int i = 0; i < M; ++i) {
        cin >> targets[i];
    }
    cout << solution.streamline(N, targets);
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 1276