akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
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(){
    ll n; cin>>n;
    ll digit=1;
    ll x=26;
    while(1){
        if(n-x>0) digit++;
        else break;
        n-=x;
        x*=26;
    }
    n--;
    // nを26進表記
    string ans="";
    ll prod=1;
    rep(i,1,digit) {
        prod*=26;
    }
    rep(i,0,digit){
        if(n/prod!=0){
            char c='a' + n/prod;
            ans+=c;
            n -= n/prod * prod;
        }else{
            ans+='a';
        }
        prod/=26;
        // debug(ans);
    }
    // debug(n);
    // debug(digit);
    cout<<ans<<endl;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {
  return '"' + s + '"';
}
string to_string(const char* s) {
  return to_string((string) s);
}
string to_string(bool b) {
  return (b ? "true" : "false");
}
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
const long long mod = 1e9+7; // CHECK
long long power(long long a, long long b, long long m = mod) {
    if(b < 0) {
        return power(power(a, -b), mod-2);
    }
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
#define ll long long
const int INT_INF = 1e9+9;
const ll LL_INF = 2e18;
const int N = 3e5+9; // check N, mod

signed main() {  
    ios_base::sync_with_stdio(false); 
    cin.tie(0); cout.tie(0);
    
    
    int x; cin >> x;
    cout << 360 / __gcd(x, 360) << endl;



    




    

    return 0;
}



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

using namespace std;

#define ZFor(i,n) for(int i=0;i<n;i++)
#define WFor(i,n) for(int i=1;i<=n;i++)
#define ZWFor(i,n) for(int i=0;i<=n;i++)
#define WZFor(i,n) for(int i=1;i<n;i++)
#define Max -2100000000
#define Min 2100000000
#define F first
#define S second
#define F1 first.first
#define F2 first.second
#define F3 second

typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;


int main(void){
	
	int n,m,t,hs[1001],bn,k;
	
	scanf("%d %d",&n,&m);
	WFor(i,n) scanf("%d",&hs[i]);
	
	for(int i=1;i<=m;i++){
		//printf("\n");
		WZFor(j,n){
			bn=hs[j]%i;
			//printf("bn %d\n",bn);
			if(bn>hs[j+1]%i){
				swap(hs[j],hs[j+1]);
				//printf("hs[%d]=%d\n",j+1,hs[j+1]);
			}
		}
	//	WFor(i,n) printf("%d\n",hs[i]);
	}
	//printf("\n");
	WFor(i,n) printf("%d\n",hs[i]);
	
	return 0;
}

Measured memory_bytes: 3184
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Queue;
import java.io.BufferedReader;
import java.util.LinkedList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Coer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskG solver = new TaskG();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskG {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            ArrayList<Integer>[] G = new ArrayList[n + 1];
            for (int i = 0; i < n + 1; i++) {
                G[i] = new ArrayList<>();
            }
            int[] deg = new int[n + 1];
            for (int i = 0; i < m; i++) {
                int u = in.nextInt();
                int v = in.nextInt();
                G[u].add(v);
                deg[v]++;
            }
            int[] dp = new int[n + 1];
            int res = 0;
            Queue<Integer> queue = new LinkedList<>();
            for (int i = 1; i < n + 1; i++) {
                if (deg[i] == 0) {
                    queue.add(i);
                }
            }
            while (!queue.isEmpty()) {
                int u = queue.poll();
                for (int i = 0; i < G[u].size(); i++) {
                    int v = G[u].get(i);
                    dp[v] = Math.max(dp[v], dp[u] + 1);
                    res = Math.max(res, dp[v]);
                    if (--deg[v] == 0) {
                        queue.add(v);
                    }
                }
            }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}

Measured memory_bytes: 54288
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  if(N==0){
    cout << "0" << endl;
    return 0;
  }
  string ans ="";
  while(N!=0){
    if(N % -2 != 0){
      N--;
      ans = "1" + ans;
    }
    else ans = "0" + ans;
    N /= -2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*input
2 11
00
*/

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

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(long long* a,long long n,long long val){
    for(long long i=0;i<n;i++)
        a[i]=val;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t=1,i,j;
    ll n,p;
    cin>>n>>p;
    string s;
    cin>>s;
    ll ans=0;
    if(p==2||p==5){
        rep(i,0,n){
            if((s[i]-48)%p)continue;
            ans+=(i+1);
        }
    }else{
        ll m[p]={0},k=0;
        m[0]=1;
        rep(i,0,n){
            k*=10;
            k%=p;
            k+=(s[i]-48);
            k%=p;
            ll kk=k*power(10,n-i-1,p);
          	kk%=p;
            ans+=m[kk];
            m[kk]++;
        }   
    }   
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 720
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e6+5;
const int mod=1e9+7;
ll n,s;
ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            for(int k=1;k<=n;k++)
                s=s+gcd(gcd(i,j),k);
    cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    long long int k, i, j, leng=0, a=0, ans=0;
    char s[200001];
    memset(s, '\0', 200001);
    scanf("%s", s);
    for(i=0; 1; i++){
        if(s[i]=='\0') break;
        leng++;
    }
    for(i=0; i<leng; i++){
        if(s[i]!='A'&&s[i]!='B'&&s[i]!='C') s[i] = '.';
        if(s[i]!='A'){
            if(s[i]=='B'&&s[i+1]!='C') s[i] = '.';
            if(s[i]=='C'&&(i==0||s[i-1]!='B')) s[i] = '.';
        }
    }
    for(i=0; i<leng; i++){
        if(s[i]=='.') a=0;
        else if(s[i]=='A') a++;
        else if(s[i]=='B'&&s[i+1]=='C') ans += a;
    }
    printf("%lld", ans);
}

Measured memory_bytes: 384
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		execute7_1();
	}
	
	private static void execute7_1() {
		try (Scanner sc = new Scanner(System.in)) {
			int M = sc.nextInt();
			int K = sc.nextInt();
			Integer[] m = new Integer[M];
			
			for(int i=0;i<M;i++) {
				m[i]=sc.nextInt();
			}
			
			int range=0;
			
			int lastV=m[0];
			int curV=0;
			for(int i=0; i<K;i++) {
				curV+=m[i];
			}
			int maxV =curV;
			for(int i=K; i<M;i++) {
				curV=curV-lastV+m[i];
				lastV=m[i-K+1];
				if(maxV<curV) {
					maxV=curV;
					range=i-K+1;
				}
			}
			
			double ans = 0;
			
			for(int i=range; i<range+K; i++) {
				ans+=expectV(m[i]);
			}
			System.out.println(ans);
			
		}
	}
	
	private static double expectV(int a) {
		double r = 0;
		for(double i=1;i<=a; i++) {
			r+=i;
		}
		return r/a;
		
	}
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }


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

    ll N = in(), D = in(), X = in(), A[100];
    rep(i, N) A[i] = in();

    // 式変形して計算
    ll s = 0;
    rep(i, N) {
        s += (D-1) / A[i];
    }
    cout << X + N + s << endl;

    return 0;
}


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

int main(void){
    int n,p,even=0,odd=0;
    long long ans=1,tmp1=1,tmp2=0;
    scanf("%d%d",&n,&p);
    int a[n];
    for (int i=0; i<n; i++){
        scanf("%d",&a[i]);
        if(a[i]%2==0){
            even++;
        } else {
            odd++;
        }
    }
    if (p==0){
        for (int i=0; i<even; i++){
            ans*=2;
        }
        for (int i=0; i<=odd/2; i++){
            for (int j=0; j<i*2; j++){
                tmp1=tmp1*(odd-j)/(j+1);
            }
            tmp2+=tmp1;
            tmp1=1;
        }
        ans=ans*tmp2;
    } else {
        for (int i=0; i<even; i++){
            ans*=2;
        }
        for (int i=0; i<odd/2; i++){
            for(int j=0; j<i*2+1; j++){
                tmp1=tmp1*(odd-j)/(j+1);
            }
            tmp2+=tmp1;
            tmp1=1;
        }
        ans=ans*tmp2;
    }
    printf("%lld\n",ans);
	return 0 ;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}

constexpr ll LNF = 1LL<<50;

constexpr int INF = 1e9+7;

const long double PI=3.14159265358979323846;


vector<int> dx = {1,0,-1,1,-1,0};
vector<int> dy = {1,1,1,0,0,-1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x,y; cin >> x >> y;
    rep(i,0,x+1){
        int a = i*2+(x-i)*4;
        if(a==y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3656
n=int(input())
hoge=list(map(int,input().split()))
ans=-1
for i in range(201):
  i=-100+i
  same=0
  for hg in hoge:
    same+=(i-hg)**2
  if(ans==-1):
    ans=same
  else:
    ans=min(same,ans)
print(ans)
  

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
 
int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll n;
	cin >> n;
	vector <ll> arr(5);
	ll mini = LLONG_MAX;
	for (int z=0;z<5;z++){
		cin >> arr[z];
		mini = min(mini,arr[z]);
	}
	ll answer = n/mini;
	if (n%mini != 0) answer++;
	cout << answer+4 << endl;
	cin >> n;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<math.h> 
#include<algorithm> 
#include<sstream>
#include<fstream>  
using namespace std; 
typedef long long ll; 
typedef long double ld; 

int ceil(int a, int m){
    // division of a and m
    if(a % m == 0){
        return a/m; 
    }
    else{
        return a/m + 1; 
    }
}

vector<int> sort(vector<int> arr){
    sort(arr.begin(), arr.end()); 
    return arr; 
}





int main(){

char nl = '\n'; 
/*
For array arr use the following preamble to sort
int diff = sizeof(arr)/sizeof(arr[0]); 
sort(arr, arr + diff); 

*/

int l,r,d;
int counter = 0;  
cin >> l >> r >> d;
for(int i = l; i<= r; i++){
    if(i % d == 0){
        counter++; 
    }
}
cout << nl << counter; 

}

Measured memory_bytes: 3636
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    in(N);

    vll v(4);
    rep(i, N)
    {
        string s;
        in(s);
        if (s == "AC")       v[0]++;
        else if (s == "WA")  v[1]++;
        else if (s == "TLE") v[2]++;
        else if (s == "RE")  v[3]++;
    }

    cout << "AC x " << v[0] << endl;
    cout << "WA x " << v[1] << endl;
    cout << "TLE x " << v[2] << endl;
    cout << "RE x " << v[3] << endl;
    return 0;
}

Measured memory_bytes: 3600
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    string s; cin>>s;

    int ans = 0;
    for(int i=0; i<10; i++){
        for(int j=0; j<10; j++){
            for(int k=0; k<10; k++){
                int state = 1;
                for(int l=0; l<n; l++){
                    int cur = s[l] - '0';

                    if(i == cur && state == 1) state++;
                    else if(j == cur && state == 2) state++;
                    else if(k == cur && state == 3) ans++, state++;

                    if(state == 4) break;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
n,k = map(int,input().split())
d = []
a = []
sunuke = [0] * n
for i in range(k):
         d.append(int(input()))
         a.append(list(map(int,input().split())))
for i in range(k):
         for j in range(d[i]):
                  if sunuke[a[i][j] - 1] == 0:
                           sunuke[a[i][j] - 1] += 1
print(n - sum(sunuke))


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

int main()
{
    int N, A, c;
    int b = 30;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        c = 0;
        cin >> A;
        while (A % 2 == 0)
        {
            A = A / 2;
            c++;
        }
        if (c < b)
        {
            b = c;
        }
    }
    cout << b << endl;
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<stdlib.h>

int gcd(int a, int b) {

	return b ? gcd(b, a % b) : a;

}

int compare(const void *a, const void *b) {
	return *(int *)a - *(int *)b;
}

int main() {

	int i, j, n, x, min;

	scanf("%d%d", &n, &x);
	int *xi = (int *)malloc(sizeof(int)*(n + 1));
	for (i = 0; i < n; i++) {
		scanf("%d", &xi[i]);
	}
	xi[n] = x;

	qsort(xi, n + 1, sizeof(int), compare);

	min = xi[1] - xi[0];

	for (i = 2; i < n + 1; i++) {
		min = gcd(min, xi[i] - xi[i - 1]);
	}

	printf("%d\n", min);

	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  int n = s.size();
  if (n % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  else {
    rep(i, n) {
      if (i % 2 == 0) {
        if (s[i] != 'h') {
          cout << "No" << endl;
          return 0;
        }
      }
      else {
        if (s[i] != 'i') {
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;


  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int dp[3][100010];
    int n,k,r,s,p;
    cin>>n>>k>>r>>s>>p;
    string t;
    cin>>t;
    int ans=0;
    for(int i=0;i<k;++i){
        int pos=0;
        for(int j=0;j*k+i<t.length();++j){
            if(t[j*k+i]=='r'){
                dp[0][j+1]=max(dp[1][j],dp[2][j]);
                dp[1][j+1]=max(dp[0][j]+p,dp[2][j]+p);
                dp[2][j+1]=max(dp[1][j],dp[0][j]);
            }
            else if(t[j*k+i]=='p'){
                dp[0][j+1]=max(dp[1][j],dp[2][j]);
                dp[1][j+1]=max(dp[0][j],dp[2][j]);
                dp[2][j+1]=max(dp[1][j]+s,dp[0][j]+s);
            }
            else{
                dp[0][j+1]=max(dp[1][j]+r,dp[2][j]+r);
                dp[1][j+1]=max(dp[0][j],dp[2][j]);
                dp[2][j+1]=max(dp[1][j],dp[0][j]);
            }
            pos=j+1;
        }
        ans+=max({dp[0][pos],dp[1][pos],dp[2][pos]});
    }
    cout<<ans<<endl;
}


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

int main(){
	int n;
	int ans=0;
	
	scanf(" %d", &n);
	if(n==0) ans=1;
	else if(n==1) ans=2;
	else if(n==2) ans=1;
	
	printf("%d\n", ans);
}

Measured memory_bytes: 1188
#include<stdio.h>
int main(){
  int n,i,j,m,s;
  char a[9],b[9];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",a,b);
    m=1;
    s=0;
    for(j=0;a[j]!=0;j++){
      if('0'<=a[j]&&a[j]<='9'){
	m=a[j++]-'0';
      }
      if(a[j]=='m')m*=1000;
      else if(a[j]=='c')m*=100;
      else if(a[j]=='x')m*=10;
      s+=m;
      m=1;
    }//printf("%d ",s);
    for(j=0;b[j]!=0;j++){
      if('0'<=b[j]&&b[j]<='9'){
	m=b[j++]-'0';
      }
      if(b[j]=='m')m*=1000;
      else if(b[j]=='c')m*=100;
      else if(b[j]=='x')m*=10;
      s+=m;
      m=1;
    }//printf("%d\n",s);
    if(s/1000>1)printf("%d",s/1000);
    if(s/1000)printf("m");
    s%=1000;
    if(s/100>1)printf("%d",s/100);
    if(s/100)printf("c");
    s%=100;
    if(s/10>1)printf("%d",s/10);
    if(s/10)printf("x");
    s%=10;
    if(s>1)printf("%d",s);
    if(s)printf("i");
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

const int N = 1111111;
bool prime[N + 1];
vector<int> primes;

void hurui()
{
	memset(prime, true, sizeof(prime));
	prime[0] = prime[1] = false;
	for (int i = 2; i*i < N; i++)
	{
		if (!prime[i]) continue;
		for (int j = i; i*j < N; j++)
		{
			prime[i*j] = false;
		}
	}
	REP(i, N + 1)
	{
		if (prime[i]) primes.push_back(i);
	}
}

const int dx[] = { -1, 0, 0, 1 }, dy[] = { 0, -1, 1, 0 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }


bool fld[1200][1200] = {};
int ind[1200][1200];
pii hs[1111111];

void init()
{
	REP(i, 1200)REP(j, 1200) ind[i][j] = INF;
	hurui();
	int p = 1, x = 600, y = 600;
	FOR(i, 1, 11111111)
	{
		if (i % 2)
		{
			REP(j, i)
			{
				ind[x][y] = p;
				hs[p] = pii(x, y);
				if (prime[p]) fld[x][y] = true;
				p++;
				y++;
			}
			REP(j, i)
			{
				ind[x][y] = p;
				hs[p] = pii(x, y);
				if (prime[p]) fld[x][y] = true;
				p++;
				x--;
			}
		}
		else
		{
			REP(j, i)
			{
				ind[x][y] = p;
				hs[p] = pii(x, y);
				if (prime[p]) fld[x][y] = true;
				p++;
				y--;
			}
			REP(j, i)
			{
				ind[x][y] = p;
				hs[p] = pii(x, y);
				if (prime[p]) fld[x][y] = true;
				p++;
				x++;
			}
		}
		if (p > 1000000) break;
	}
}

pii dp[1200][1200];
int n, m;

pii solve(int x, int y)
{
	if (dp[x][y] != pii(-1, -1)) return dp[x][y];
	pii res(0, -1);
	FOR(i, -1, 2)
	{
		int nx = x + 1, ny = y + i;
		if (ind[nx][ny] > m) continue;
		pii next = solve(nx, ny);
		if (fld[nx][ny])
		{
			if (next.first == 0) chmax(res, pii(next.first + 1, ind[nx][ny]));
			else chmax(res, pii(next.first + 1, next.second));
		}
		else chmax(res, next);
	}
	return dp[x][y] = res;
}

int main()
{
	init();
	while (cin >> m >> n, n)
	{
		REP(i, 1200)REP(j, 1200) dp[i][j] = pii(-1, -1);
		pii ans = solve(hs[n].first, hs[n].second);
		if (prime[n])
		{
			ans.first++;
			if (ans.first == 1) ans.second = n;
		}
		if (ans.first == 0) cout << "0 0" << endl;
		else cout << ans.first << " " << ans.second << endl;
	}
	return 0;
}

Measured memory_bytes: 30392
void main() {
    int[] tmp = readln.split.to!(int[]);
    int a = tmp[0], b = tmp[1];
    string s = readln.chomp;
    bool ok = true;
    foreach (i, x; s) {
        if (i == a) {
            if (x != '-') {
                ok = false;
            }
        } else {
            if (!x.isNumber) {
                ok = false;
            }
        }
    }
    writeln(ok ? "Yes" : "No");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    string s;cin>>s;
    for(int i=0;i<s.length();i++)cout<<'x';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

int main(){
    int A, B, H, M; cin >> A >> B >> H >> M;

    // 長針の角度
    double n_angle = (double)(H*(30)) + (double)(0.5*M);
    // 短針の角度
    double m_angle = (double)6*M;
    // 針間の角度
    double angle = min(abs(n_angle-m_angle), 360-abs(n_angle-m_angle));
    // 針間の角度のラジアン
    double rad = angle * M_PI / 180;
    // 余弦定理
    double ans = sqrt(pow(A,2) + pow(B,2) - 2 * A * B * cos(rad));

    cout << fixed << setprecision(20);
    cout << ans << endl;
}

Measured memory_bytes: 4200
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C=0,D=0;
    string S;
    cin >> A >> B;
    vector<vector<int>>P(A,vector<int>(B,0));
    for(int i=0;i<A;i++){
        for(int j=0;j<B;j++)cin>>P[i][j];
    }
    for(int i=0;i<A;i++){
        for(int j=i+1;j<A;j++){
            C=0;
            for(int k=0;k<B;k++)C+=(P[i][k]-P[j][k])*(P[i][k]-P[j][k]);
            int E=sqrt(C);
            if(E*E==C)D++;
        }
    }
    cout << D<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

#define N 100     
#define SUCCESS 1 // 成功
#define FAILURE 0 // 失敗
#define INFTY 1 << 21 // 到達不可能を表す大きな値

int queue[N]; // キューの本体
int queue_head = 0; // データ先頭
int queue_num; // データ個数

int node_num, M[N + 1][N + 1];
int d[N]; // 距離で訪問状態(color)を管理する

int enqueue(int enq_data) // キューにデータを追加する
{
  if (queue_head + queue_num < N) {
    queue[queue_head + queue_num] = enq_data;
    queue_num++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

int dequeue(int *deq_data) // キューからデータを取り出す
{
  if (queue_num > 0) {
    *deq_data = queue[queue_head];
    queue_num--;
    queue_head++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

void bfs(int s) {
  enqueue(s); // 始点をキューに入れる
  for (int i = 1; i <= node_num; i++) d[i] = INFTY; // とりあえず全部INFTYにする
  d[s] = 0; // 始点から自分自身までの距離は0
  int u, p;
  while(queue_num > 0) { // キューが空でない間繰り返す
    u = queue[queue_head]; // キューの先頭からノードを取り出し，訪問
    dequeue(&p); // 同上
    for (int v = 1; v <= node_num; v++) {
        if (M[u][v] == 0) continue; // キュー先頭のノードとvが繋がってないならこのループは終了
        if (d[v] != INFTY) continue; // 既に距離を決めているならこのループは終了
        d[v] = d[u] + 1; // 次に訪問するノードまでの距離は，それまでの距離+1
        enqueue(v); // uに繋がっているノードは将来訪問しないといけない
    }
  }
  for (int i = 1; i <= node_num; i++) { // 表示部
    if (d[i] == INFTY) d[i] = -1;
    printf("%d %d\n", i, d[i]);
  }
}

// mainの流れはdfsと同じ(隣接行列の初期化→隣接行列にノード間の接続関係を登録→bfsを呼び出す)
int main(void)
{
  int u, v, k, i, j;
  
  scanf("%d", &node_num);
  for (i = 0; i <= node_num; i++) {
    for(j = 0; j <= node_num; j++) M[i][j] = 0;
  }

  for (i = 0; i < node_num; i++) {
    scanf("%d %d", &u, &k);
    for (j = 0; j < k; j++) {
      scanf("%d", &v);
      M[u][v] = 1;
    }
  }

  bfs(1);
  
  return 0;
}


Measured memory_bytes: 2044
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct FenwickTree {
  ll data[101000];
  void add(int index, ll v) {
    for (index += 3; index <= 100100; index += index & -index) {
      data[index] += v;
    }
  }
  ll sum(int index) {
    ll ret = 0;
    for (index += 3; index > 0; index -= index & -index) {
      ret += data[index];
    }
    return ret;
  }
};

struct Number {
  ll num;
  char str[15];
  Number() {;}
  Number(ll num) : num(num) {
    sprintf(str, "%lld", num);
  }
  bool operator<(const Number &rhs) const {
    return strcmp(str, rhs.str) < 0;
  }
};

Number numbers[100100];
FenwickTree ftree;
ll P;

int main() {
  ll A, B;
  while (scanf("%lld %lld %lld", &A, &B, &P), A|B|P) {
    int n = B - A + 1;
    MEMSET(ftree.data, 0);
    REP(i, n) {
      numbers[i] = Number(A + i);
    }
    sort(numbers, numbers + n);
    ll ans = 0;
    REP(i, n) {
      ll v = (ftree.sum(numbers[i].num - A) + 1) % P;
      ans = (ans + v) % P;
      ftree.add(numbers[i].num - A, v);
    }
    printf("%lld\n", ans);
  }
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        vi a(3);
        rep0(3) cin>>a[i];
        sort(all(a));
        cout<<a[0]+a[1];        
     }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1000010;
const int inf=0x3f3f3f3f;

ll n;
ll dp[maxn];
ll a[maxn];
ll k;
void dfs()
{
    
    dp[1]=0;
    dp[0]=0;
     for(int i=2;i<=n;i++)
    {
        dp[i]=inf;
    }
    
    for(int i=2;i<=n;i++)
    {for(int j=i-1;j>=max(1ll,i-k);j--)
        {
         dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n];
    return ;
}

int main()
 { 
      cin>>n>>k;
      for(int i=1;i<=n;i++)
      cin>>a[i];
      dfs();
 }

Measured memory_bytes: 5184
#!/usr/bin/env python3
#ABC132 A
import sys
sys.setrecursionlimit(1000000)
from collections import deque

S = list(input())
T = list(set(S))
for i in T:
    if S.count(i) != 2:
        print('No')
        quit()
if len(T) == 2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3444
N,M=map(int,input().split())
MOD=10**9+7

frac=[0]*max(N+1,M+1)
frac[0]=1

if abs(N-M)>1:
	print(0)
	exit()

for i in range(1,max(N+1,M+1)):
	frac[i]=(frac[i-1]*i)%MOD
	
if N==M:
	print((2*frac[N]*frac[M])%MOD)
else:
	print((frac[N]*frac[M])%MOD)

Measured memory_bytes: 6900
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define endl "\n"
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
ll power(ll x, ll y, ll p) { 
    ll res = 1;    x = x % p;  
    while(y > 0) {
        if(y & 1) res = (res*x) % p; 
        y = y>>1;    x = (x*x) % p; 
    } return res; 
}
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        
        string str;
        cin>>str;
        if(str[str.length()-1]=='s')
        {
            cout<<str<<"es"<<endl;
        }
        else
        cout<<str<<"s"<<endl;
        
    }
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1000
using namespace std;

int main(){
	int n;
	string s,t;
	cin>>n>>s>>t;
	int num=INF;
	rep(i,s.size()){
		bool check=true;
		rep(j,t.size()-i){
			if(s[i+j]!=t[j]){
				check=false;
				break;
			}
		}
		if(check)num=min(num,(int)s.size()+i);
	}
	if(num==1000)num=2*n;
	cout<<num<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;
//#define int long long
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>vec[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int kurai(int x00, int y00) {
	int z00 = (x00 % jousu(10, y00)) / jousu(10, y00 - 1);
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}



int main() {
	int n;
	double a, t=0, ans;
	cin >> n;
	rep(i, n) {
		cin >> a;
		t += 1.0 / a;
	}
	ans = 1.0 / t;
	printf("%.10lf", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-10
using namespace std;
typedef long long ll;
const int mods = 998244353;
const int maxn = 2e5+10;
const int N = 1e6+10;
const int E = 1e6+10;  
ll n,m,k;
ll cnt[maxn],a[maxn];
ll sum;

int main(){
	cin>>n;
	F(i,1,n){
		cin>>a[i];
		cnt[a[i]]++;
	} 
	F(i,1,n){
		sum+=((cnt[i]-1)*cnt[i])/2;
	}
	ll tmp = 0;
	F(i,1,n){
		tmp =  (-1)*max((ll)0,cnt[a[i]]-1);
		cout<<sum+tmp<<endl;
	}
}

Measured memory_bytes: 4736
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int N;
	cin >> N;
	for(int i=1;i<=N;i++){
		if(N==int(i*1.08)){
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;

	return 0;
}



Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
 
struct bian{
	int x,to,next;
}edge[400001];
int cnt,head[100001],dis[100001];
bool vis[100001],f;
 
inline void add(int u,int v,int x)
{
	edge[++cnt].x=x,edge[cnt].to=v,edge[cnt].next=head[u],head[u]=cnt;
}
 
inline void dfs(int x)
{
	for(int i=head[x];i;i=edge[i].next){
		if(!vis[edge[i].to]){
			vis[edge[i].to]=1;
			dis[edge[i].to]=dis[x]+edge[i].x;
			dfs(edge[i].to);
		}
		else if(dis[edge[i].to]!=dis[x]+edge[i].x){
			f=0;
			return;
		}
	}
}
 
int main()
{
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int l,r,d;
		cin>>l>>r>>d;
		add(l,r,-d),add(r,l,d);
	}
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			vis[i]=1;
			f=1;
			dfs(i);
			if(!f||dis[i]!=0){
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes";
}

Measured memory_bytes: 6912
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int myPower(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

void precalc() {
}


const int maxn = (int) 2e3 + 10;
int n, m, k;

int read() {
  if (scanf("%d%d%d", &n, &m, &k) < 3) {
    return 0;
  }
  return 1;
}

const int maxc = maxn * 3;
int dp[maxc][maxc];

void solve() {
  memset(dp, 0, sizeof(dp));
  for (int r = 1; r < k; ++r) {
    add(dp[r][k - r], 1);
    add(dp[r + 1][k - r - 1], mod - 1);
  }
  int res = 0;

  const int M = n + m;
  for (int x = 0; x <= M; ++x) {
    for (int y = 0; y <= M; ++y) {
      int cur = dp[x][y];
      if (!cur) {
        continue;
      }
      //eprintf("dp[%d][%d] = %d\n", x, y, cur);
      if (y) {
        add(dp[x + 1][y - 1], cur);
      }

      if (x <= n && y <= m && (n - x) % (k - 1) == 0 && (m - y) % (k - 1) == 0) {
        add(res, cur);
      }
      add(dp[x][y + k - 1], cur);
      if (y) {
        add(dp[x + k][y - 1], mod - cur);
      }
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 142336
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
 struct Node{
  int key;
   struct Node *right,*left,*parent;
 };

struct Node *root,*NIL;

struct Node *find(struct Node *u,int k){
  while(u!=NIL && k!=u->key){
    if(k < u->key){
      u=u->left;
    }
    else{
      u=u->right;
    }
  }
    return u;
}

void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z;

  z=(struct Node *)malloc(sizeof(struct Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else{
    if(z->key < y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(struct Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char com[10];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(strcmp(com,"find")==0){
      scanf("%d",&x);
      struct Node *t=find(root,x);
      if(t!=NIL){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
    else if(strcmp(com,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strcmp(com,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}
      



Measured memory_bytes: 20476
#include<iostream>
#include<algorithm>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int N,x;
main()
{
	cin>>N>>x;
	int ans=0;
	for(int i=0;i<N;i++)
	{
		int y;cin>>y;y-=x;
		if(y<0)y=-y;
		ans=gcd(ans,y);
	}
	cout<<ans<<endl;
}


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

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

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    string S;
    cin >> N >> S;
    string ans = " ";
    iter(c, S) {
        if(ans.back() != c) ans.push_back(c);
    }
    cout << ans.size() - 1 << endl;
    return 0;
}


Measured memory_bytes: 3720