akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;
int main()
{
  cout<<fixed<<setprecision(10);
  int A,B,C;
  cin >> A >> B >> C;
  cout << min(B/A,C) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  string s; cin>>s;
  bool ans=true;
  rep(i, s.size()) {
    if(i%2==0) {
      if(s.at(i)!='R'&&s.at(i)!='U'&&s.at(i)!='D') ans=false;
    }
    else {
      if(s.at(i)!='L'&&s.at(i)!='U'&&s.at(i)!='D') ans=false;
    }
  }
  
  if(ans==true) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int n, k, m;

int main(void){
    while (cin >> n >> k >> m, n | k | m) {
        vector<int> v;
        for (int i = 0; i < n; i++) v.push_back(i+1);
        int idx = (m-1) % n;
        v.erase(v.begin() + idx);
        //for (int i = 0; i < v.size(); i++) cout << v[i];cout <<endl;
        
        for (int i = 0; i < n-2; i++) {
            idx = (idx + (k-1)) % (n-1-i);
            v.erase(v.begin() + idx);
            //for (int i = 0; i < v.size(); i++) cout << v[i];cout<<endl;
        }
        cout << v[0] << endl;
    }
    return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S[2],R;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S[0]>>S[1];
	
	FOR(i,100) FOR(j,2) if(S[j].size()) {
		R += S[j][0];
		S[j].erase(S[j].begin());
	}
	cout<<R<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

#define ll long long int
#define oo (1L<<60)

ll memo[100005];
char visitado[100005];
int piedras[100005];
int N, K;

ll costo(int n){
	if(n<0) return oo;
	if(!n) return 0;
	if(visitado[n]) return memo[n];
	visitado[n] = 1;
	memo[n] = oo;
	for(int i = 1; i<=K; i++)
		memo[n] = min(memo[n], costo(n-i)+abs(piedras[n]-piedras[n-i]));
	return memo[n];
}

int main() {
	cin>>N>>K;
	for(int i = 0; i<N;i++)
		cin>>piedras[i];
	cout<<costo(N-1)<<"\n";
	return 0;
}

Measured memory_bytes: 11100
#include <iostream>

int main(){
  int D;
  std::cin >> D;

  if(D == 25) std::cout << "Christmas" << std::endl;
  else if (D == 24 ) std::cout << "Christmas Eve" << std::endl;
  else if (D == 23 ) std::cout << "Christmas Eve Eve" << std::endl;
  else if (D == 22 ) std::cout << "Christmas Eve Eve Eve" << std::endl;

  return 0;
}


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

// num[i]...iが書かれているカードの数
// num2[i]..i枚ある数字の個数
// num2_sum[i]..i枚以下ある数字の個数
// f[i].....i回操作を行える、Kの最大値

int N, num[300001], num2[300001], num2_sum[300001];
vector<int> f(300001);

int main(){
	cin >> N;
	for(int i=0; i<N; i++){
		int a; cin >> a;
		num[a]++;
	}
	for(int i=0; i<=N; i++) num2[num[i]]++;
	num2_sum[0] = num2[0];
	for(int i=1; i<=N; i++){
		num2_sum[i] = num2_sum[i-1] + num2[i];
	}
	int sum = 0;
	for(int i=0; i<=N; i++){
		sum += min(num[i], 1);
	}
	f[0] = -1e9;
	f[1] = sum;
	f[1] *= -1;
	for(int i=2; i<=N; i++){
		sum = sum + num2[i] + (num2_sum[N] - num2_sum[i]);
		f[i] = sum/i;
		f[i] *= -1;
	}
	for(int i=1; i<=N; i++){
		int ans = lower_bound(f.begin(), f.end(), -i+1) - f.begin();
		cout << ans - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int a, b, c, d, sum = 0;
    cin >> a >> b >> c >> d;
    if (a > b) {
        sum += b;
    }else{
        sum += a;
    }
    if (c > d) {
        sum += d;
    }else{
        sum += c;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
N, K = (int(i) for i in input().split())

S = input()

if S[K - 1] == "A":
    S = S[:K-1]+"a"+S[K:]
if S[K - 1] == "B":
    S = S[:K-1] + "b" + S[K:]
if S[K - 1] == "C":
    S = S[:K-1]+"c"+S[K:]

print(S)


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

int main() {
  int A, B;
  cin >> A >> B;
  int ans = 0;
  if (A+B==3) ans = 3;
  else if (A+B==4) ans = 2;
  else ans = 1;
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
g = [[2**64]*n for i in range(n)]
for i in range(n):
    u, k, *l, = map(int, input().split())
    for j in range(k):
        v, c = l[j*2], l[j*2+1]
        g[u][v] = c

'''
ダイクストラ法による単一始点最短経路
'''
d = [2**64]*n
d[0] = 0

s = []
v = [i for i in range(n)]
while len(s) < n:
    c, u = 2**32, -1
    for vv in v:
        if d[vv] < c:
            c, u = d[vv], vv
    s.append(u)
    v.remove(u)
    for i, c in enumerate(g[u]):
        if i in v and d[u]+g[u][i] < d[i]:
            d[i] = d[u]+g[u][i]

for i in range(n):
    print(f"{i} {d[i]}")



Measured memory_bytes: 5764
w,h,n=map(int,input().split())
i,j=0,0
for _ in [0]*n:
  x,y,a=map(int,input().split())
  if a==1 and i<x:
    i=x
  elif a==2 and w>x:
    w=x
  elif a==3 and j<y:
    j=y
  elif a==4 and h>y:
    h=y
print(max(h-j,0)*max(w-i,0))


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int n; cin >> n;
  int ans = 0;
  vector<int> l(2*n);
  for(int i = 0; i < 2*n; i++) cin >> l[i];
  sort(l.begin(), l.end());
  for(int i = 0; i <= 2*(n-1); i+=2) {
    ans += min(l[i], l[i+1]);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
/*
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const double PI = acos(-1.0);

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  double r;
  cin >> r;

  printf("%.6lf %.6lf\n", PI * r * r, PI * 2 * r);
  return 0;
}

Measured memory_bytes: 1240
n,X = gets.chomp.split(" ").map(&:to_i)
x = gets.chomp.split(" ").map(&:to_i).sort
x.map!{|a| (a - X).abs}
gcd = x[0]
(n-1).times do |i|
  gcd = gcd.gcd(x[i+1])
end
puts gcd


Measured memory_bytes: 23212
#include <bits/stdc++.h>
typedef long long lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()

using namespace std;

void execute()
{
	lint N;
	lint ans = 1;
	cin >> N;

	for (lint i = 1; i <= N; i++)
	{
		ans *= i;
		ans %= 1000000007;
	}

	cout << ans << endl;
	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

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

int main() {

  string s;
  cin >> s;

  if(s[0]=='7'||s[1]=='7'||s[2]=='7') {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3628
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, d = inintm()

ans = 0

for i in range(n):
    x, y = inintm()
    if math.sqrt(x**2 + y**2) <= d:
        ans += 1

print(ans)

Measured memory_bytes: 68956
n,m=map(int,input().split())
a=[1]*n
for i in range(m):
        x=int(input())
        a[x-1]=0
mod=10**9+7
if a[0]==0:
        f=[1,1]
else:
        f=[1,2]
if n==1:
        print(f[0])
elif n==2:
        print(f[1])
else:
        for i in range(2,n):
                f.append((a[i-1]*f[i-1]+a[i-2]*f[i-2])%mod)
        print(f[-1])

Measured memory_bytes: 50648
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



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

    int N, M; cin >> N >> M;
    vector<vector<int>> to(N);
    rep(i, M) {
        int s, t; cin >> s >> t; --s; --t;
        to[s].push_back(t);
    }

    vector<double> dp(N, 0.0);
    reprev(i, N-1) {
        double val = 0.0;
        for(auto j: to[i]) val += dp[j];
        val /= to[i].size();
        val += 1;
        dp[i] = val;
    }

    double ans = dp[0];

    rep(ni, N-1) {
        if(to[ni].size() == 1) continue;
        int nj = to[ni][0];
        for(auto j: to[ni]) {
            if(dp[j] > dp[nj]) nj = j;
        }

        vector<double> dp2(N, 0.0);
        reprev(i, N-1) {
            double val = 0.0;
            for(auto j: to[i]) {
                if(i == ni && j == nj) continue;
                val += dp2[j];
            }
            int sz = to[i].size();
            if(i == ni) --sz;
            val /= sz;
            val += 1;
            dp2[i] = val;
        }

        chmin(ans, dp2[0]);
    }

    cout << fixed << setprecision(10) << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1408
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		int N = GetInt();
		int T = GetInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++)
			A[i] = GetInt();
		
		Dictionary<int, int> numB = new Dictionary<int, int>();
		int minA = int.MaxValue;
		int maxB = 0;
		for(int i = 1; i < N; i++)
		{
			minA = Math.Min(minA, A[i-1]);
			int tmpB = A[i] - minA;
			int currentNum = 0;
			numB.TryGetValue(tmpB, out currentNum);
			numB[tmpB] = currentNum + 1;
			maxB = Math.Max(maxB, tmpB);
		}

		Console.WriteLine(numB[maxB]);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 30432
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ちゃんとユニークな配列にする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N, K;
  cin >> N >> K;
  int sum = 0;

  rep(i, N) {
    int x;
    cin >> x;
    int a = x * 2;
    int b = abs(x - K) * 2;
    int min_cost = min(a, b);
    sum += min_cost;
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
from functools import reduce


def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


def _gcd(*n):
    return reduce(gcd, n)


N, X = map(int, input().split())
x = list(map(int, input().split()))
x = sorted(x + [X])
diff = [x[i+1] - x[i] for i in range(N)]
print(_gcd(*diff))


Measured memory_bytes: 14596
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    ans = 0
    for _ in range(N):
        x, u = [x for x in input().split()]
        if u == 'BTC':
            ans += float(x) * 380000.0
        else:
            ans += float(x)

    print(ans)

    

if __name__ == '__main__':
    main()




Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
 int a,b,c,i,n=0;

 scanf("%d %d %d",&a,&b,&c);

 for(i=a;i<=b;i++){
  if((c%i)==0){
   n++;
  }
 }

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

 return 0;
}

Measured memory_bytes: 1812
import java.util.Scanner;

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

		int n = sc.nextInt();
		int[] a = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		int minCost = 40_000 * n;
		for (int i = -100; i <= 100; i++) {
			int sumCost = 0;
			for (int j = 0; j < n; j++) {
				int sub = a[j] - i;
				sumCost += sub * sub;
			}

			if (sumCost < minCost) {
				minCost = sumCost;
			}
		}

		System.out.println(minCost);

		sc.close();
	}

}


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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX_N 1000100

using namespace std;

typedef unsigned long long ll;

ll euler_phi(ll n){
  ll res = n;
  for(ll i=2;i*i<=n;i++){
    if(n%i==0){
      res = res / i * (i-1);
      for(;n%i==0;n/=i);
    }
  }
  if(n!=1)res = res/n*(n-1);
  return res;
}

ll euler[MAX_N];
ll answer[MAX_N];

void euler_phi2(){
  for(ll i=0;i<MAX_N;i++)euler[i] = i;
  for(ll i=2;i<MAX_N;i++){
    if(euler[i] == i){
      for(ll j=i;j<MAX_N;j+=i)euler[j]=euler[j]/i*(i-1);
    }
  }
}

int main(){
  euler_phi2();
  answer[1] = 2;
  REP(i,2,MAX_N)answer[i] = answer[i-1] + euler[i];
  int t,n;
  scanf("%d",&t);
  rep(_,t){
    scanf("%d",&n);
    printf("%lld\n",answer[n]);
  }
  return 0;
}

Measured memory_bytes: 16812
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n, k;
    cin >> n >> k;
    vector<li> as(n);
    map<li, vector<li>> indexes;
    for (int i = 0; i < n; ++i) {
        cin >> as[i];
        indexes[as[i]].push_back(i);
    }

    vector<li> consumes(n);
    for (auto& p : indexes) {
        const li num = p.first;
        const vector<li>& poses = p.second;
        for (int i = 0; i < poses.size(); ++i) {
            li fr = poses[i];
            li to = poses[(i + 1) % poses.size()];
            if (fr < to) {
                consumes[fr] = to - fr + 1;
            } else {
                consumes[fr] = (n - fr) + to + 1;
            }
        }
    }

    li rot = 0, pos = 0;
    do {
        pos += consumes[pos];
        while (pos >= n) {
            pos -= n;
            rot += 1;
        }
    } while (pos != 0);

    k %= rot;
    rot = 0;
    pos = 0;
    vector<li> s;
    while (true) {
        if (rot >= k) {
            break;
        }
        li npos = pos + consumes[pos];
        li nrot = rot;
        while (npos >= n) {
            npos -= n;
            nrot += 1;
        }
        if (nrot >= k + 1 || (nrot == k && npos != 0)) {
            // overrun, keep.
            s.push_back(as[pos]);

            // increment instead.
            if (pos == n - 1) {
                npos = 0;
                nrot = rot + 1;
            } else {
                npos = pos + 1;
                nrot = rot;
            }
        }

        pos = npos;
        rot = nrot;
    }

    for (int i = 0; i < s.size(); ++i) {
        cout << s[i];
        if (i + 1 == s.size()) {
            cout << endl;
        } else {
            cout << " ";
        }
    }
    return 0;
}

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

int main() {
  int A, B,C,D;
  cin >> A >> B>>C>>D;

  if (A+B>C+D){
    cout<<"Left"<<endl;
  }
  else if(A+B==C+D){
    cout<<"Balanced"<<endl;
  }
  else if(A+B<C+D){
    cout<<"Right"<<endl;
  }
}
  
  
  

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

using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;
    cout << a[k - 1] << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
const long long INF=2E17;
typedef pair<LL,LL> Pair;

const int MAX=100010;

int main(){
    int N,M;
    vector<Pair> AB;
    cin >> N >> M;
    LL tmp,tmp2;
    for(int i=0;i<N;i++){
        cin >> tmp >> tmp2;
        AB.push_back(make_pair(tmp,tmp2));
    } 
    sort(
        AB.begin(),
        AB.end(),
        [](const Pair& x, const Pair& y){return x.first < y.first;}
        );
    LL cnt=0;
    LL ans=0;
    for(int i=0;i<N;i++){
        if(AB[i].second < M-cnt){
            ans+=AB[i].first * AB[i].second;
            cnt+=AB[i].second;
        }else{
            ans+=AB[i].first * (M-cnt);
            cnt+=M-cnt;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

const int d = 365;
int main() {
  vector<int> c(26);
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
  }
  vector<vector<int>> s(d, vector<int>(26));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }

  vector<int> t(26);
  for (int i = 0; i < 26; i++) {
    t[i] = i + 1;
  }

  for (int i = 0; i < d; i++) {
    cout << t[rand() % 26] << endl;
  }

  return 0;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int acs=0,was=0;
    vector<bool> flag(n,false);
    vector<int> wa(n,0);
    for(int i=0;i<m;i++){
        int p;
        string s;
        cin>>p;
        cin>>s;
        p--;
        if(s=="AC"){
            if(!flag[p]){
                flag[p]=true;
                acs++;
                was+=wa[p];
            }
        }else{
            if(!flag[p]){
                wa[p]++;
            }
        }
    }
    cout<<acs<<" "<<was<<"\n";
    return(0);
}

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

int main() {
 int N, X, T, x;
 cin >> N;
 cin >> X;
 cin >> T;
 x = N / X;
 if(N % X != 0){
  x = T * (x + 1);
 }else{
  x = T * x;
 }
  cout << x << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

void print_a(VI v)
{
    if(v.size()) cout<<v[0];
    loop(i,1,v.size()) cout<<' '<<v[i];
    cout<<'\n';
}

VVI init_vvi(int n, int m, int val)
{
    return VVI(n,VI(m,val));
}

VVL init_vvl(int n, int m, LL val)
{
    return VVL(n,VL(m,val));
}

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;
    cin>>n;
    int a, ans = 0;
    loop(i,1,n+1)
    {
        cin>>a;
        if(i & 1 && a & 1) ++ans;
    }

    cout<<ans<<'\n';

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n)
    {
        cin>>a[i];
    }
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
 int a[10000];
 int b = 0;
 int c = 0;

 while(b != 1)
{
 scanf("%d", &a[c]);

 if (a[c] != 0)
 printf("Case %d: %d\n", c + 1, a[c]);

 if (a[c] == 0)
 b = 1;

 
 c = c + 1;

}

 return 0;

}



Measured memory_bytes: 2048
import numpy as np

a,b,x=map(int,input().split())
S=a**2*b-x

if a**2*b/2 <= x:
    z=S*2/(a**2)
    rad=np.arctan(z/a)
else:
    z=x*2/(a*b)
    rad=np.arctan(b/z)
print(np.rad2deg(rad))


Measured memory_bytes: 22420
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 100010;

int s[N],mx[N];
struct edge{
	int x,nxt,c;
}e[N*2];
int h[N],tot;
int n;
LL ans,co[N];

void inse(int x,int y,int c){
	e[++tot].x=y;
	e[tot].c=c;
	e[tot].nxt=h[x];
	h[x]=tot;
}

void dfs(int x){
	s[x]=1;
	mx[x]=0;
	for(int p=h[x];p;p=e[p].nxt)
	if (!s[e[p].x]){
		co[e[p].x]=e[p].c;
		dfs(e[p].x);
		s[x]+=s[e[p].x];
		mx[x]=max(mx[x],s[e[p].x]);
	}
	mx[x]=max(mx[x],n-s[x]);
	ans=ans+2ll*co[x]*min(n-s[x],s[x]);
}

int main(){
	n=get();
	fo(i,2,n){
		int x=get(),y=get(),v=get();
		inse(x,y,v);
		inse(y,x,v);
	}
	dfs(1);
	bool bz=0;
	fo(x,2,n)
	if (s[x]==n-s[x]){
		ans=ans-co[x];
		bz=1;
		break;
	}
	if (!bz)
	fo(i,1,n)
	if (mx[i]<=n/2){
		int tmp =1e+9;
		for(int p=h[i];p;p=e[p].nxt)tmp=min(tmp,e[p].c);
		ans=ans-tmp;
		break;
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
typedef long long ll;

int gcf (int a, int b)
{
    if (b == 0) return a;
    return gcf (b, a % b);
}

int main()
{
    ios_base::sync_with_stdio(0);

    int x;
    cin >> x;
    int v = gcf (x, 360);
    cout << 360 / v << "\n";
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N; cin >> N;
  vector<int> a(N);
  REP(i,N) cin >> a[i];
  vector<int> s = a;
  sort(s.rbegin(), s.rend());
  REP(i,N) {
    int ans = s[0];
    if(s[0]==a[i]) ans = s[1];
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3200
n=int(input())
ac=0
tle=0
re=0
wa=0
for i in range(n):
  s=input()
  if(s=='AC'):
  	ac+=1
  if(s=='TLE'):
  	tle+=1 
  if(s=='RE'):
  	re+=1
  if(s=='WA'):
  	wa+=1
print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)

Measured memory_bytes: 9180
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int N = sc.nextInt();
        int[] a = new int[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                a[i] = sc.nextInt();    
        }
        
        int L = 0;
        int H = 0;
        for(int i = 0 ; i < N - 1 ; i++){
            H = a[i + 1] - a[i];
            if(L < H){
                L = H;
            }
            //System.out.println(i + " " + H + " " + L);
        }
        
        H = (K + a[0]) - a[N - 1];
        if(L < H){
                L = H;
            }
        //System.out.println(H + " " + L);
        System.out.print(K - L);
    }
}

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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    int k, a, b, ans = 0;
    cin >> k >> a >> b;
    bool f = false;
    if(a % k == 0){
        f = true;
    }
    if((a - (a % k) + k) <= b){
        f = true;
    }
    cout << (f? "OK" : "NG") << endl;
    return 0;
}


Measured memory_bytes: 3628
// A - Five Variables
#include <bits/stdc++.h>
using namespace std;

int main(){
	int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
	if(a == 0) puts("1");
	if(b == 0) puts("2");
	if(c == 0) puts("3");
	if(d == 0) puts("4");
	if(e == 0) puts("5");
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
            #include <ext/pb_ds/assoc_container.hpp>
            #include <ext/pb_ds/tree_policy.hpp>
            using namespace std;
            using namespace __gnu_pbds;
            #define rep(i,a,b) for(ll i =a; i<b;++i)
            #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
            #define endl "\n"
            #define pb push_back
            #define F first
            #define S second
            #define print(a)       for(auto x : a) cout << x << " "; cout << endl
            #define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
            #define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl
            #define mk(x,y)  make_pair(x,y)
            typedef long long int ll;
            const ll N =  1e6+ 5 ;
            const ll mod = 998244353;
            ll   n  ,a[N] , q , x,y, cnt[N];
    ll pow_mod_m(ll a , ll n)
    {
        if(!n)
            return 1;
        ll pt =  pow_mod_m(a,n/2);
        pt *= pt , pt %= mod;
        if(n&1)
            pt *= a  ,pt %= mod;
        return pt;
    }


    int main()
    {
         IOS;
         int ts =1;
         while(ts--)
         {
            cin >> n;
            rep(i,0,n) {cin >> a[i];
            }
            ll xors = 0;
            rep(i,0,n) xors = xors ^ a[i];
            rep(i,0,n)
            {
                cout << (xors ^ a[i])  << " " ;
            }
         }
    }


Measured memory_bytes: 5132
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

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

        int A  =sc.nextInt();
        int B = sc.nextInt();
        BigInteger big = new BigInteger(String.valueOf(A));
        big = big.multiply(new BigInteger(String.valueOf(B)));
        int r;
        while (A%B!=0){
            r = A%B;
            A=B;
            B = r;
        }


        big = big.divide(new BigInteger(String.valueOf(B)));
        System.out.println(big);


    }
}


Measured memory_bytes: 23252
K, N = map(int, input().split())
A = list(map(int, input().split()))
diff = []
A.sort()
for idx in range(len(A)):
    if idx == len(A)-1:
        tmp = abs(A[idx] - A[0])
        if tmp > K/2:
            tmp = K - tmp
        diff.append(tmp)
    else:
        tmp = abs(A[idx+1] - A[idx])
        if tmp > K/2:
            tmp = K - tmp
        diff.append(tmp)

print(K - max(diff))



Measured memory_bytes: 87628
n = int(input())

for i in range(n):
	input()
	board = [list(input()) for i in range(8)]
	sx = int(input()) - 1
	sy = int(input()) - 1

	board[sy][sx] == 2
	bomb = []
	n_bomb = [[sy, sx]]
	points = []
	for j in range(len(board)):
		while '1' in board[j]:
			px = board[j].index('1')
			py = j
			points.append([py, px])
			board[j][px] = '2'
	
	while len(n_bomb) != 0:
		bomb += n_bomb
		n_bomb = []
		for b in bomb:
			for p in points:
				if (p[0] == b[0] and b[1]-3 <= p[1] <= b[1]+3) or (p[1] == b[1] and b[0]-3 <= p[0] <= b[0]+3):
					points.remove(p)
					n_bomb.append(p)
	
	ans = [['0'] * 8 for j in range(8)]
	for p in points:
		ans[p[0]][p[1]] = '1'

	print("Data %s:" % str(i+1))
	for p in ans:
		print("".join(p))

Measured memory_bytes: 6764
import java.util.*;
public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			int [] data = new int[n];
			for(int i = 0; i < n; i++){
				data[i] = sc.nextInt();

			}
			Arrays.sort(data);
			long [] data2 = new long[n];
			long sum = 0;
			data2[0] = 0;
			for(int i = 1; i < n; i++){
				data2[i] = data2[i-1] + data[i-1];
			}

			for(int i = 0; i < n; i++){
				sum += data2[i];
			}
			System.out.println(sum);
		}
	}

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

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);

            double A = N[0] / N[1];

            Console.WriteLine(A);
        }
    }
}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(c-a) <= d || (abs(b-a) <= d && abs(c-b) <= d)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

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

    if(a == b && b == c)
        cout << "No" << endl;
    else if(a != b && b != c && c != a)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
def prime_factorize(N):
    # 素因数分解
    import math as m
    a = []
    for i in range(2, int(m.sqrt(N)) + 1):
        while N % i == 0:
            a.append(i)
            N //= i
    if N > 1:
        a.append(N)
    return a


def resolve():
    N = int(input())
    a = prime_factorize(N)
    print(str(N) + ":", *a)


resolve()



Measured memory_bytes: 5664
//
// Created on 2020/06/27.
//

#include <iostream> // cout, endl, cin
#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
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int n;
    cin>>n;
    ll ans = 0;
    vector<ll>yakusu(n+1,0);
    for (ll i = 1; i <= n; ++i) {
        ans += i * (((n/i)*(n/i+1))/2);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 81328
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	int n;
	cin>>n;
	map<pair<ll,ll>,ll>cnt;
	vector<pair<ll,ll>>v(n);
	rep(i,n){
		double num;
		cin>>num;
		ll x=llround(1000000000LL*num);
		ll two=0,five=0;
		while(x%2==0){
			x/=2;
			++two;
		}
		while(x%5==0){
			x/=5;
			++five;
		}
		two-=9;
		five-=9;
		cnt[make_pair(two,five)]++;
		v[i]=make_pair(two,five);
	}
	ll ans=0;
	rep(i,n){
		ll two=v[i].first;
		ll five=v[i].second;
		cnt[make_pair(two,five)]--;
		for(auto x:cnt){
			if(two+x.first.first>=0&&five+x.first.second>=0){
				ans+=x.second;
			}
		}
	}
	cout<<ans<<"\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

bool g[8][8];
int dfs(int v, int n, bool visited[8])
{
  bool all_visited = true;
  for (int i = 0; i < n; i++)
  {
    if (!visited[i])
    {
      all_visited = false;
      break;
    }
  }

  if (all_visited)
  {
    return 1;
  }

  int res = 0;
  for (int i = 0; i < n; i++)
  {
    if (visited[i] || !g[v][i])
    {
      continue;
    }
    else
    {
      visited[i] = true;
      res += dfs(i, n, visited);
      visited[i] = false;
    }
  }

  return res;
}

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

  for (int i = 0; i < 8; i++)
  {
    for (int j = 0; j < 8; j++)
    {
      g[i][j] = false;
    }
  }

  int a, b;
  for (int i = 0; i < m; i++)
  {
    cin >> a >> b;
    a--;
    b--;
    g[a][b] = g[b][a] = true;
  }

  bool visited[8];
  for (int i = 0; i < 8; i++)
  {
    visited[i] = false;
  }
  visited[0] = true;

  cout << dfs(0, n, visited) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int i,j, k=0,n;
  scanf("%d", &n);
  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(A[i]>k){
      k=A[i];
    }
  }
  for(i=0;i<=k;i++){//Initialize
    C[i]=0;
  }
  for(j=1;j<=n;j++){//Counting
    C[A[j]]++;
  }
  for(i=1;i<=k;i++){//SumOfCounting
    C[i]=C[i]+C[i-1];
  }	
  for(j=n;0<j;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
    printf("%d",B[1]);
  for(i=2;i<n+1;i++){
    printf(" %d",B[i]);
  }
  printf("\n");
  return 0;
}



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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

const int INF = 1e9+7;

using ipair = pair<int, int>;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}



int main(){
    int X, Y;
    cin >> X >> Y;

    cout << X + Y/2 << endl;

    return 0;
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ap = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var p = ap[0] * 3 + ap[1];
            Console.WriteLine(p / 2);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;
typedef long long ll ;

int n;

string cad ="ACGT";
ll ans[105][5][5][5];
//set<string> dict;

void generate(int b , int c , int d, int e){
	string auxi = "";
	auxi+=cad[b];auxi+=cad[c];auxi+=cad[d];auxi+=cad[e];
	//dict.insert(auxi);
	//cout<<cad[b]<<cad[c]<<cad[d]<<cad[e]<<"\n";
}

int main(){
	fastio;
	cin>>n;
	
	for(int b=0; b<4;b++){
		for(int c=0; c<4;c++){
			for(int d=0; d<4;d++){	
				if(b==0 && c==1 && d==2) continue;
				if(b==0 && c==2 && d==1) continue;
				if(b==2 && c==0 && d==1) continue;
				ans[3][b][c][d] = 1LL;
			}
		}
	}
	
	for(int a=4; a<=100;a++){
		for(int b=0; b<4;b++){
			for(int c=0; c<4;c++){
				for(int d=0; d<4;d++){
					for(int e=0; e<4;e++){
						if((b==0 || c==0) && d==2 && e==1)  continue;
						if(b==0 && c==2 && (d==1 || e==1) ) continue; 
						if(b==0 && c==1 && d==2) continue;
						if(c==0 && d==1 && e==2) continue; 
						if(b==2 && c==0 && d==1) continue;
						if(c==2 && d==0 && e==1) continue;
						ans[a][c][d][e] = (ans[a][c][d][e] + ans[a-1][b][c][d]) %  1000000007LL;
					}
				}
			}
		}
	}
	/*
	for(auto it=dict.begin();it!=dict.end();it++){
		cout<<*it<<"\n";
	}*/
	ll tot = 0LL;
	for(int b=0; b<4;b++){
			for(int c=0; c<4;c++){
				for(int d=0; d<4;d++){
					tot = (tot + ans[n][b][c][d])%  1000000007LL;
			}
		}
	}
	cout<<tot<<"\n";
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
typedef pair<int, int> ii;
int N, M, masks[49];
ii uv[20];
long long dptable[1 << 20][49];
vector<ii> adjlist[50];
bool dfs(int v, int p, int mask) {
	if (v == uv[mask].second - 1) return true;
	for (ii i: adjlist[v]) {
		if (i.first == p) continue;
		if (dfs(i.first, v, mask)) {
			masks[i.second] = masks[i.second] | (1 << mask);
			return true;
		}
	}
	return false;
}
long long dp(int i, int j) {
	if (j == N - 1) return i == (1 << M) - 1 ? 1: 0;
	if (dptable[i][j] != -1) return dptable[i][j];
	return dptable[i][j] = (dp(i | masks[j], j + 1) + dp(i, j + 1));
}
int main() {
	memset(dptable, -1, sizeof dptable);
	int a, b;
	scanf("%d", &N);
	for (int i = 1; i < N; ++i) {
		scanf("%d %d", &a, &b);
		adjlist[a - 1].push_back(ii(b - 1, i - 1));
		adjlist[b - 1].push_back(ii(a - 1, i - 1));
	}
	scanf("%d", &M);
	for (int i = 0; i < M; ++i) scanf("%d %d", &uv[i].first, &uv[i].second);
	for (int i = 0; i < M; ++i) dfs(uv[i].first - 1, -1, i);
	printf("%lld", dp(0, 0));
	return 0;
}

Measured memory_bytes: 401664
#include<iostream>
#include<climits>
#include<numeric>
#include<algorithm>
#include <sstream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<utility>
#include<array>
#include<vector>
#include<iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<forward_list>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif
ll n;
cin>>n;
ll count=0;
for (int i = 1; i <=n; ++i)
{
	if (i%2==1)
	{
		count++;
		/* code */
	}
	/* code */
}
//cout<<count<<endl;
long double rahul=count/n;
cout<<setprecision(10)<<fixed<<double(count)/double(n)<<endl;


return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	map<char,int> ct;
	for (const char &ch : s)
		ct[ch]++;
	map<int,int> ret;
	for (const auto &it : ct)
		ret[it.second]++;
	cout<<(ret[2]==2?"Yes":"No")<<"\n";
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include<boost/multiprecision/cpp_int.hpp>
// namespace multiprecisioninteger = boost::multiprecision;
// using cint=multiprecisioninteger::cpp_int;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;++i)
#define bFor(i,b,a) for(i=b,--i;i>=(ll)a;--i)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N,0)
#define brep1(i,N) bFor(i,N,1)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define eb emplace_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
#define matoutput(v) do{for(auto outimat:v)output(outimat);}while(0)
// const ll mod=1000000007;
const ll mod=998244353;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vector<int> diviserlist(int N){
  int i;
  vector<int> res;
  for(i=1;i*i<N;i++){
    if(N%i==0){
      res.eb(i);res.eb(N/i);
    }
  }
  if(i*i==N)res.eb(i);
  return res;
}

ll dp[1000001];
int main(){
  startupcpp();
  int i,j,N;
  ll ans=0,sum,psum;
  cin>>N;
  vec a(N);
  mat solve(1000001);
  rep(i,N){
    cin>>a[i];
    vector<int> diva=diviserlist(a[i]);
    for(int x:diva){
      solve[x].eb(a[i]);
    }
  }
  brep1(i,1000001)if(solve[i].size()>1){
    sum=psum=0;
    for(ll x:solve[i]){
      sum+=x;
      psum+=x*x%mod;
    }
    sum%=mod;
    psum%=mod;
    dp[i]=(sum*sum-psum+mod)%mod*499122177%mod;
    for(j=i<<1;j<=1000000;j+=i){
      dp[i]-=dp[j];
    }
    dp[i]=(dp[i]%mod+mod)%mod;
  }
  rep1(i,1000001)ans+=moddevide(dp[i],i);
  print(ans%mod);
}

Measured memory_bytes: 105280
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;



void Main(){

  int M,D;
  cin >> M >>D;

  int ct=0;
  reps(i,1,M+1){
    reps(j,1,D+1){

      int dx=j/10;
      int dy=j%10;

      if(dx>=2&&dy>=2&&i==dx*dy) ct++;

    }
  }



  cout << ct <<"\n";
}


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


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int A[4][100001];
int F[4][100001];
int n;

int main()
{
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>A[1][i]>>A[2][i]>>A[3][i];
    }
    F[1][1]=A[1][1];
    F[2][1]=A[2][1];
    F[3][1]=A[3][1];
    for(int i=2; i<=n; i++)
    {
        for(int j=1; j<=3; j++)
        {
            for(int z=1; z<=3; z++)
            {
                if(z!=j)
                {
                    F[j][i]=max(F[j][i], A[j][i]+F[z][i-1]);
                }
            }
        }
    }
    int m=0;
    for(int i=1; i<=3; i++) m=max(m, F[i][n]);
    cout<<m;

    return 0;
}


Measured memory_bytes: 2560