akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;	
int n,ans;
int a[100005];
vector<pair<int,int> > res;
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	for(int i=n-2;i>=1;i--){
		if(a[i]<0) break;
		res.push_back(make_pair(a[0],a[i]));
		a[0]-=a[i];
	}
	for(int i=1;i<=n-2;i++){
		if(a[i]>=0) break;
		res.push_back(make_pair(a[n-1],a[i]));
		a[n-1]-=a[i];
	}
	ans=a[n-1]-a[0];
	res.push_back(make_pair(a[n-1],a[0]));
	printf("%d\n",ans);
	for(int i=0;i<res.size();i++){
		printf("%d %d\n",res[i].first,res[i].second);
	}
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
 #define int long long 
 
 
 signed main(){
     int n,m;
     cin>>n>>m;
     if(n<m){
         for(int i=0;i<m;i++){
             cout<<n;
         }
     }
     else{
         for(int i=0;i<n;i++){
             cout<<m;
         }
     }
     
     
     
     
 }

Measured memory_bytes: 256
import sys
n = int(input())
a = []

if (n==1):
    print(1)
    sys.exit()

def prime_factorize(n,a):
    while n%2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f*f <= n:
        if n%f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in range(2,n+1):
    a = prime_factorize(i,a)

a.sort()
c = []
count = 1
for i in range(1,len(a)):
    if(a[i-1]!=a[i]):
        c.append(count)
        count = 1
    else:
        count += 1
c.append(count)

ans = 1
for i in range(0,len(c)):
    ans *= (c[i]+1)
print(ans % 1000000007)

Measured memory_bytes: 3064
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int a[32]={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;
    for(int i=1; i<=32; i++)
    {
        if(k==i)
        {
            cout<<a[i-1];
            break;
        }
    }

}


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

const int maxn = 1e5+10;
int a[maxn];
int b[maxn];
int n;

int c[maxn],tmp[maxn];
long long ans;

void Merge(int l,int m,int r)
{
    int i = l;
    int j = m + 1;
    int k = l;
    while(i <= m && j <= r)
    {
        if(c[i] > c[j])
        {
            tmp[k++] = c[j++];
            ans += m - i + 1;
        }
        else
        {
            tmp[k++] = c[i++];
        }
    }
       while(i <= m) tmp[k++] = c[i++];
    while(j <= r) tmp[k++] = c[j++];
    for(int i=l;i<=r;i++)
        c[i] = tmp[i];
}
 
void Merge_sort(int l,int r)
{
    if(l < r)
    {
        int m = (l + r) >> 1;
        Merge_sort(l,m);
        Merge_sort(m+1,r);
        Merge(l,m,r);
    }
}

int lowbit(int x){
    return x&(-x);
}

void add(int x,int d){
    while(x<=n){
        b[x]+=d;
        x+=lowbit(x);
    }
}


int sum(int x){
    int res = 0;
    while(x){
        res+=b[x];
        x-=lowbit(x);
    }
    return res;
}

bool cc(int d){
    memset(b,0,sizeof(b));
for(int i=1;i<=n;i++){
    if(a[i]>=d)add(i,1);
    else add(i,-1);
}
    for(int i=1;i<=n;i++)c[i] = sum(i);
        ans = 0;
        for(int i=1;i<=n;i++){
            if(c[i]<0)ans++;//单个前缀和小于0
        }
        Merge_sort(1,n);//统计逆序数
        long long num = 1LL*n*(n+1)/2 - ans;
        return num>=ans;
}

int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    int ub = 1e9;
    int lb = 0;
        while(ub-lb>1){
            int mid = lb+(ub-lb)/2;
            if(cc(mid))lb = mid;
            else ub = mid;
        }
        if(cc(lb+1))lb++;
        printf("%d\n",lb);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
  int n,c;cin>>n>>c;
  int d[c][c];
  rep(i,c) rep(j,c){
    int tmp;cin>>tmp;
    d[i][j]=tmp;
  }
  int init[n][n];
  rep(i,n) rep(j,n){
    int tmp;cin>>tmp;
    init[i][j]=tmp;
  }

  int ctr[3][c];memset(ctr,0,sizeof(ctr));
  rep(i,n) rep(j,n){
    ctr[(i+j)%3][init[i][j]-1]++;
  }
  int ans=1e9+7;
  rep(i,c) rep(j,c) rep(k,c){
    if(i==j||j==k||k==i)continue;
    int sum=0;
    rep(x,c){
      sum+=ctr[0][x]*d[x][i];
      sum+=ctr[1][x]*d[x][j];
      sum+=ctr[2][x]*d[x][k];
    }
    chmin(ans,sum);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

ll n, q;
vector<vector<ll>> g;
vector<ll> cnt;

void dfs(ll v, ll p = -1) {
    for(auto u : g[v]) {
        if (u == p) continue;
        cnt[u] += cnt[v];
        dfs(u, v);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    cin >> n >> q;
    g.resize(n);
    cnt.resize(n, 0);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i, q) {
        ll p, x;
        cin >> p >> x;
        p--;
        cnt[p] += x;
    }
    dfs(0);
    rep(i, n) printf("%lld%s", cnt[i], (i == (n - 1)) ? "\n" : " ");
    return 0;
}


Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
ll dp[50][3000];
int main()
{
    fast;
    
	ll a,b,h;
	cin>>a>>b>>h;
 
 	ll area=(h/2)*(b-a) +a*h;
 	
 	cout<<area;
 
}

		
	
	
	
	


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
using ll = long long;
int n;
char d[]={'a','b','c','d','e','f','g','h','i','j'};
int cnt=0;

int dfs(int k,string s,int mx){
  if(k==n){
    cout<<s<<endl;
    return 0;
  }
  rep(i,mx){
    string t=s;
    t+=d[i];
    dfs(k+1,t,max(mx,i+2));
  }
}

int main(){
  cin>>n;
  dfs(0,"",1);
  return(0);
}


Measured memory_bytes: 1536
#include <cstdio>
using namespace std;
int n,k;
int main(){
    scanf("%d%d",&k,&n);
    if ((k+1)/2<n){
        printf("-1\n");
        return 0;
    }

    int t;
    for (int x=0;x<k;x++){
        t=x/2;
        if (x&1) printf("%d %d %d\n",n+(k+1)/2+t,n+k+t,n+k*2+x);
        else printf("%d %d %d\n",n+t,n+k+k/2+t,n+k*2+x);
    }
}


Measured memory_bytes: 2176
#include<cstdio>
#include<algorithm>
const int MAXN=100000+5;
int val[MAXN],n,max,max2;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&val[i]);
	std::sort(val+1,val+n+1);
	for(int i=1;i<n;i++)
		if(val[i]==val[i+1])
		{
			max2=max;
			max=val[i];
			i++;
		}
	printf("%lld",(long long)max2*max);
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    int Array[] = new int[3];
    Scanner InData = new Scanner(System.in);
    Array[0] = InData.nextInt();
    Array[1] = InData.nextInt();
    Array[2] = InData.nextInt();
    int buffer;
    for(int n = 0; n<2;n++){
        for(int j = 0;j<2-n;j++){
            if(Array[j]>Array[j+1]){
            buffer = Array[j];
            Array[j]=Array[j+1];
            Array[j+1]=buffer;
            }
        }

    }
   System.out.println(Array[0]+" "+Array[1]+" "+Array[2]);
   
  
    }
}

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

int main(){
    int a,b,c,n=0,x;cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(x==500*i+100*j+50*k) n++;
            }
        }
    }
    cout<<n<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second
using namespace std;


int main()
{
    int n,t;
    cin >> n >> t;
    vector<int> a;
    for(int i = 0; i < n; i++){
        int x,y;
        cin >> x >> y;
        if(y <= t){
            a.push_back(x);
        }
    }
    if(a.size() == 0){
        cout << "TLE" << endl;
        return 0;
    }
    cout << *std::min_element(a.begin(), a.end()) << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }

int div(int n) {
  int cnt = 0;
  while(n % 2 == 0){
    cnt++;
    n /= 2;
  }
  return cnt;
}

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

  int max = 0, s = 0;
  fo(i, 2, n+1) {
    if(max < div(i)) {
      max = div(i);
      s = i;
    }
  }

  if(n > 1) cout << s << endl;
  else cout << 1 << endl;

  return 0;
}


Measured memory_bytes: 256
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w)) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))

Measured memory_bytes: 250944
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean ans = true;
		String s = sc.next();
		char c[] = s.toCharArray();
		if (n % 2 == 1) {
			System.out.println("No");
		} else {
			for (int i = 0; i <= (s.length() / 2) - 1; i++) {
				if (c[i] != c[i +( s.length() / 2)]) {
					//System.out.println("!");
					ans = false;
				}
			}
			if (ans) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}

	}
}

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


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.group_count = n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        self.group_count -= 1

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

def int_(num_str):
    return int(num_str) - 1


N, M, K = map(int, input().split())
uf = UnionFind(N)
some = [1] * N
for i in range(M):
    a, b = map(int_, input().split())
    uf.union(a, b)
    some[a] += 1
    some[b] += 1
for i in range(K):
    c, d = map(int_, input().split())
    if not uf.same(c, d):
        pass
    else:
        some[c] += 1
        some[d] += 1


ans = [uf.size(i) - some[i] for i in range(N)]
print(*ans)


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

using namespace std;

#define inf (1LL << 50)

int N,M;
vector<vector<long long int>>bridge;

long long int solve(vector<long long int>D, long long int idx){
	long long int ret = 0;
	for(int i = idx; i < N; i++){
		auto next = D;

		for(int j = 0; j < N; j++){
			if(i!=j && D[j] != -1){
				if(D[i] == -1)D[i] = bridge[i][j];
				D[i] = min(D[i], bridge[i][j]);
				D[j] = min(D[j], bridge[i][j]);
			}
		}
		long long int plus = 0;
		for(int j = 0; j < N; j++){
			long long int x = D[j];
			long long int y = next[j];
			if(x == -1)x = 0;
			if(y == -1)y = 0;
			plus += x - y;
		}
		if(plus >= 0){
			ret = max(ret, solve(D, i + 1));
		}
		D = next;
	}
	long long int sum = 0;
	for(int i = 0; i < N; i++){
		if(D[i] != -1){
			sum += D[i];
		}
	}
	return max(sum, ret);
}

int main(){
	cin >> N >> M;
	bridge = vector<vector<long long int>>(N, vector<long long int>(N));
	vector<pair<long long int,long long int>>bridgepair(M);
	for(int i = 0; i < M; i++){
		long long int a,b,c;
		cin >> a >> b >> c;
		a--; b--;
		bridge[a][b] = c;
		bridge[b][a] = c;
		bridgepair[i]=(make_pair(a,b));
	}
	long long int ans=0;
	for(int i = 0; i < M; i++){
		auto x = vector<long long int>(N, -1);
		x[bridgepair[i].first]=bridge[bridgepair[i].first][bridgepair[i].second];
		x[bridgepair[i].second]=bridge[bridgepair[i].first][bridgepair[i].second];
		ans = max(ans, solve(x, 0));
		bridge[bridgepair[i].first][bridgepair[i].second] = -inf;
//		bridge[bridgepair[i].second][bridgepair[i].first] = -inf;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3244
#pragma warning(disable:4996)
#include "bits/stdc++.h"
using namespace std;

//macro
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,a,b) for(int i=(int)(b) - 1;i>=(int)(a);i--)
#define rrep(i,n) RREP(i,0,n)
#define each(i, ctn) for (auto &&i : (ctn))
#define all(a) (a).begin(),(a).end()
#define mp make_pair
#define INFL 1145148100000000000LL
#define EPS (1e-8)
#define MOD 1000000007
#define PI 3.141592653589793
#define equals(a,b)(fabs((a)-(b))<EPS)

//alias
using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vs = vector<string>;
using P = pair<ll, ll>;
template<class T> using heap = priority_queue<T>;
template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>;

//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H);	rep(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n)os << v[i] << (i == n - 1 ? "\n" : " "); return os; }
template <class T = int> inline T in() { T x; cin >> x; return x; }
template<class T> inline void print(const T &x) { cout << x << '\n'; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } pre__;

int main() {
	int N;
	N = in();
	vll A(N);
	rep(n, N)A[n] = in();

	multiset<ll> ms;
	set<ll> s;
	rep(n, N) {
		s.insert(A[n]);
		ms.insert(A[n]);
	}

	ll ans = 0;
	for(auto s_ : s){
		ll x = (ll)ms.count(s_) - s_;
		if (x < 0)ans += (ll)ms.count(s_);
		else ans += x;
	}

	print(ans);
	return 0;
}


Measured memory_bytes: 9984
#include<stdio.h>

int main (){
	char S[4];
	char T[4];
	scanf("%s",S);
	scanf("%s",T);
	int correct=0;
	int i;
	for (i=0;i<3;i++){
		if (S[i]==T[i])
		correct++;
	}
	printf("%d\n",correct);
	return 0;
}


Measured memory_bytes: 128
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int N,num[200][3],out[200];
    cin>>N;
    for(int i=0;i<N;i++)for(int j=0;j<3;j++)cin>>num[i][j];
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<200;j++)out[j]=0;
        for(int j=0;j<N-1;j++)for(int k=j+1;k<N;k++)if(num[j][i]==num[k][i])
        {
            out[j]=1;
            out[k]=1;
        }
        for(int j=0;j<N;j++)if(out[j]!=0)num[j][i]=0;
    }
    for(int i=0;i<N;i++)cout<<num[i][0]+num[i][1]+num[i][2]<<endl;
    return 0;
}

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

#define MOD 1000000007

using lint = long long int;
using pii = std::pair<int, int>;

using std::vector;
lint dp[100][20];
char dom[2][100];
int N;

lint recursion(int ind, int col) {
	if (ind == N) {
		return 1;
	}
	if (dp[ind][col] != -1) {
		return dp[ind][col];
	}
	int up_col = col / 4;
	int down_col = col % 4;

	lint ret = 0;
	if (dom[0][ind] == dom[1][ind]) {
		for (int i = 1; i <= 3; i++) {
			if (i != up_col && i != down_col) {
				ret += recursion(ind + 1, (i * 4) + i);
				ret %= MOD;
			}
		}
	}
	else {
		for (int i = 1; i <= 3; i++) {
			if (i != up_col) {
				for (int j = 1; j <= 3; j++) {
					if (j != down_col && j != i) {
						ret += recursion(ind + 2, (i * 4) + j);
						ret %= MOD;
					}
				}
			}
		}
	}
	ret %= MOD;
	dp[ind][col] = ret;
	return ret;
}
int main(void) {
	scanf("%d\n", &N);
	scanf("%s", dom[0]);
	getchar();
	scanf("%s", dom[1]);
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 20; j++) {
			dp[i][j] = -1;
		}
	}

	printf("%lld", recursion(0, 0));

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
 
#define ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
 
const int N = 2e6 + 6;
const int M = 1e9+7;
int A[N];
int n , m;

void solve()
{

	int id = 0;
	loop(i,0,5)
	{
		cin >> A[i];
 		if(A[i] == 0)id = i;
	}
	cout << id+1;
}			
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	
 
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 3600
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd
enu = enumerate

sys.setrecursionlimit(10**7)
A, B = map(int, input().split())

for i in range(1, 1300):
    if int(i*0.08)==A and int(i*0.1)==B:
        print(i)
        exit()
else:
    print(-1)



Measured memory_bytes: 3444
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var a, b, c int
	fmt.Fscan(r, &a, &b, &c)

	list := []int{a, b, c}

	var five, seven int

	for _, s := range list {
		if s == 5 {
			five++
		} else if s == 7 {
			seven++
		}
	}

	if five == 2 && seven == 1 {
		fmt.Fprintln(w, "YES")
	} else {
		fmt.Fprintln(w, "NO")
	}

}


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

int N;
double p[3000];
double dp[3000][3000];

double f (int i, int c)
{
	if (i == N) return (c > N/2) ? 1.0 : 0.0;

	if (dp[i][c] != -1) return dp[i][c];

	return dp[i][c] = (p[i] * f(i+1, c+1)) + ((1 - p[i]) * f(i+1, c));
}

int main()
{
	ios::sync_with_stdio(false);

	cin >> N;
	for (int i = 0; i < N; ++i)
		cin >> p[i];

	for (int i = 0; i < 3000; ++i)
		for (int j = 0; j < 3000; ++j)
			dp[i][j] = -1;
		
	cout << setprecision(10) << f(0, 0) << endl;

	return 0;
}

Measured memory_bytes: 70912
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
#define N 40
#define AMT 400
#define INF 40'001
int a[N+1], b[N+1], c[N+1];
int mem[N+1][AMT+1][AMT+1];
int opt(int n, int x, int y) {
    int& ans = mem[n][x][y];
    if(ans == -1) {
        if(n == 0) {
            ans = x == 0 and y == 0 ? 0 : INF;
        } else {
            ans = opt(n - 1, x, y);
            if(x >= a[n] and y >= b[n]) {
                ans = min(ans, c[n] + opt(n - 1, x - a[n], y - b[n]));
            }
        }
    }
    return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, ma, mb;
    cin >> n >> ma >> mb;
    for(int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    memset(mem, -1, sizeof mem);
    int ans = INF;
    for(int A = 1; A <= AMT; A++) {
        for(int B = 1; B <= AMT; B++) {
            if(A * mb == B * ma) {
                ans = min(ans, opt(n, A, B));
            }
        }
    }
    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}


Measured memory_bytes: 25984
#include <stdio.h>

#define START (3)

int map[16][16];

void bomb(int x, int y);

int main(void)
{
    int n;
    int data_set;
    char str[16];
    int x, y;
    int i, j;

    scanf("%d", &n);
    for (data_set = 1; data_set <= n; data_set++){
        for (i = 0; i < 8; i++){
            scanf("%s", str);
            for (j = 0; j < 8; j++){
                map[START + i][START + j] = str[j] - '0';
            }
        }

        scanf("%d %d", &x, &y);
        bomb(START + x - 1, START + y - 1);

        printf("Data %d:\n", data_set);
        for (i = 0; i < 8; i++){
            for (j = 0; j < 8; j++){
                printf("%d", map[START + i][START + j]);
            }
            printf("\n");
        }
    }

    return (0);
}

void bomb(int x, int y)
{
    int i;

    if (map[y][x] != 1){
        return;
    }

    map[y][x] = 0;
    for (i = 1; i <= 3; i++){
        bomb(x - i, y);
        bomb(x + i, y);
        bomb(x, y - i);
        bomb(x, y + i);
    }
}

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

void fnInput(map<string, int>& rmpPoll)
{
  int nPollSiz;
  cin >> nPollSiz;

  for (int i = 0; i <= nPollSiz; i++)
  {
    string sPoll;
    cin >> sPoll;
    rmpPoll[sPoll]++;
  }
}
  
void fnMaxPollCnt(const map<string, int>& cnrmpPoll)
{
  int nMaxCnt = 0;

  for (pair<string, int> PPoll : cnrmpPoll)
    nMaxCnt = max(nMaxCnt, PPoll.second);

  for (pair<string, int> PPoll : cnrmpPoll)
  {
    if (PPoll.second == nMaxCnt)
      cout << PPoll.first << endl;
  }
}
  
int main()
{
  map<string, int> mpPoll;

  fnInput(mpPoll);
  fnMaxPollCnt(mpPoll);

  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int N, Q;
	cin >> N >> Q;
	string s;
	cin >> s;
	vector<char> t(Q);
	vector<char> d(Q);
	for (int i = 0; i < Q; ++i) {
		cin >> t[i] >> d[i];
	}

	int l_low = -1, l_high = N;
	while (l_high - l_low > 1) {
		int mid = (l_low + l_high) / 2;
		int pos = mid;
		for (int i = 0; i < Q; ++i) {
			if ((pos < 0) || (pos >= N)) { break; }

			if (s[pos] == t[i]) {
				if (d[i] == 'L') { --pos; }
				else { ++pos; }
			}
		}
		if (pos < 0) { l_low = mid; }
		else { l_high = mid; }
	}

	int r_low = -1, r_high = N;
	while (r_high - r_low > 1) {
		int mid = (r_low + r_high) / 2;
		int pos = mid;
		for (int i = 0; i < Q; ++i) {
			if ((pos < 0) || (pos >= N)) { break; }

			if (s[pos] == t[i]) {
				if (d[i] == 'L') { --pos; }
				else { ++pos; }
			}
		}
		if (pos >= N) { r_high = mid; }
		else { r_low = mid; }
	}

	int res = max(0, r_low - l_high + 1);
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 900
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  ll k=0;
  for(ll i=1;i<=n+10;i++){
    if(i*(i-1)==n*2) {
      k=i;
      break;
    }
  }
  if(k==0){
    COUT("No");
    return 0;
  }
  COUT("Yes");
  COUT(k);
  vvll ans(k,vll(0));
  ll cu=1;
  ll i=0;
  ll kk=k-1;
  ll j=1;
  while(cu<=n){
    if(sz(ans[i])-i==k-i-1){
      i++;
      j=i+1;
    }
    ans[i].pb(cu);
    ans[j].pb(cu);
    j++;
    cu++;
  }
  rep(i,k){
    cout<<sz(ans[i])<<" ";
    rep(j,sz(ans[i])){
      cout<<ans[i][j]<<" ";
    }
    cout<<endl;
  }
}


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int>a(N);
	rep(i, N) {
		cin >> a[i];
		a[i]--;
	}
	int ans = 0;
	rep(i, N) {
		if (a[a[i]] == i)ans++;
	}
	cout << ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
  ll n;cin>>n;
  ll x=n*800;
  n/=15; 
  ll y=n*200;
  cout<<x-y<<endl;
}



Measured memory_bytes: 256
import math


def main():
    n = int(input())
    As = sorted(list(map(int, input().split())))

    ans = math.gcd(As[0], As[1])
    for i in range(2, n):
        ans = math.gcd(ans, As[i])
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 20376
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};



int main(){
    int n;cin >> n;
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<vector<LL>> dp(n, vector<LL> (3, -LINF));
    if(n%2){
        dp[0][0] = a[0];
        dp[1][1] = a[1];
        dp[2][2] = a[2];
        for (int i = 0; i < n; i++) {
            if(i+2<n){
                chmax(dp[i+2][0],dp[i][0]+a[i+2]);
                chmax(dp[i+2][1],dp[i][1]+a[i+2]);
                chmax(dp[i+2][2],dp[i][2]+a[i+2]);
            }
            if(i+3<n){
                chmax(dp[i+3][2],dp[i][1]+a[i+3]);
                chmax(dp[i+3][1],dp[i][0]+a[i+3]);
            }
            if(i+4<n){
                chmax(dp[i+4][1],dp[i][0]+a[i+4]);
            }
        }
        cout << max({dp[n-1][2],dp[n-2][1],dp[n-3][0]}) << endl;
    }
    else{
        dp[1][1] = a[1];
        dp[0][0] = a[0];
        for (int i = 0; i < n; i++) {
            if(i+2<n){
                chmax(dp[i+2][1],dp[i][1]+a[i+2]);
                chmax(dp[i+2][0],dp[i][0]+a[i+2]);
            }
            if(i+3<n) chmax(dp[i+3][1],dp[i][0]+a[i+3]);
        }
        cout << max(dp[n-1][1],dp[n-2][0]) << endl;
    }
    return 0;
}



Measured memory_bytes: 15668
#include <iostream>
typedef long long ll;
#include <cmath>
#include <vector>
#include <algorithm>

void dump(int a[],int n)
{
  for (int codeTest = 0; codeTest < n; ++codeTest) {
    if (codeTest!=0)std::cout << " ";
    std::cout << a[codeTest];
  }
  std::cout << '\n';
}
ll gcd(ll m,ll n){
  if (n==0)return m;
  else{
    return gcd(n,m%n);
  }
  return 0;
}
int main() {
  ll a,b,k,i,c,ans=2,tmp=0;
  std::cin >> a >> b;
  k=gcd(a,b);
  c=2;
  if (k==1){
    std::cout << 1 << '\n';
    return 0;
  }
  while (k >= c * c) {
          if (k % c == 0) {
              k /= c;
              if (tmp!=c){
                ++ans;
              }
              tmp=c;
          } else {
              ++c;
          }
      }
  while (k%c ==0){
    k/=c;
  }
  if (k==1)--ans;
  std::cout << ans << '\n';
}


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

int main() {
  int x1, x2, x3,x4, y1, y2, y3, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  
  y3 = y2 + x2-x1;
  x3 = x2 - (y2 - y1);
  y4 = y3 + (x3 - x2);
  x4 = x3 - (y3 - y2);
  
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

Measured memory_bytes: 3620
from decimal import Decimal
def waru(N,num):
  cnt = 0
  while N%num==0:
    N //= num
    cnt += 1
  return cnt
def solve():
  N = int(input())
  num = [[0]*101 for _ in range(101)]
  lis = [0]*N
  for i in range(N):
    a = int(round(float(input())*10**9))
    p,q = waru(a,2)-9-50,waru(a,5)-9-50
    num[p][q] += 1
    lis[i] = [p,q]
  cum2 = [[0]*101 for _ in range(101)]
  for i in range(99,-1,-1):
    for j in range(99,-1,-1):
      cum2[i][j] = cum2[i+1][j]+cum2[i][j+1]-cum2[i+1][j+1]+num[i][j]
  ans = 0
  for i in range(N):
    p,q = lis[i]
    x,y = p+50,q+50
    p = -x-50
    q = -y-50
    ans += cum2[p][q]
    if x>=0 and y>=0:
      ans -= 1
  return ans//2
print(solve())

Measured memory_bytes: 100448
#include <bits/stdc++.h>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

struct node {
	int x[15];
}a[15];

int main()
{
	int n, d,ans=0;
	cin >> n >> d;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= d; j++)
			cin >> a[i].x[j];
	for (int i = 1; i <= n; i++)
	{
		for (int j = i + 1; j <= n; j++)
		{
			int sum = 0;
			for (int k = 1; k <= d; k++)
				sum += (a[i].x[k] - a[j].x[k])*(a[i].x[k] - a[j].x[k]);
			int temp = sqrt(sum);
			if (temp*temp == sum)
				ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define INF 999999999
#define rep(i,n) for(int (i)=0;(i)<n;(i)++)
#define Rrep(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=a;i<n;i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)

int main() {

	int N;
	cin >> N;
	int a;
	double  sum = 0;

	rep(i, N) {
		cin >> a;
		sum += (double)1 / a;
	}

	cout << 1 / sum << endl;

	return 0;

}

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

template<Int Mod = 1000000007> class modint{
public:
	Int val;
	constexpr modint(const Int x = 0) : val(x % Mod) {if(val < 0) val += Mod;}
	constexpr modint operator+(const modint rhs) const {
		return modint(*this) += rhs;
	}
	constexpr modint operator-(const modint rhs) const {
		return modint(*this) -= rhs;
	}
	constexpr modint operator*(const modint rhs) const {
		return modint(*this) *= rhs;
	}
	constexpr modint operator/(const modint rhs) const {
		return modint(*this) /= rhs;
	}
	constexpr modint operator-() const {
		return modint(Mod - val);
	}
	constexpr modint &operator+=(const modint rhs){
		val += rhs.val;
		if(val >= Mod) val -= Mod;
		return *this;
	}
	constexpr modint &operator-=(const modint rhs){
		if(val < rhs.val) val += Mod;
		val -= rhs.val;
		return *this;
	}
	constexpr modint &operator*=(const modint rhs){
		val *= rhs.val;
		val %= Mod;
		return *this;
	}
	constexpr modint &operator/=(const modint rhs){
		return *this *= inv(rhs);
	}
	constexpr modint &operator++(){
		++val;
		if(val == Mod) val = 0;
		return *this;
	}
	constexpr modint &operator--(){
		--val;
		if(val == -1) val = Mod - 1;
		return *this;
	}
	constexpr modint operator<<(const Int rhs) const {
		return modint(*this) << rhs;
	}
	constexpr modint operator>>(const Int rhs) const {
		return modint(*this) >> rhs;
	}
	constexpr modint &operator<<=(const Int rhs){
		val <<= rhs;
		val %= Mod;
		return *this;
	}
	constexpr modint &operator>>=(const Int rhs){
		val >>= rhs;
		val %= Mod;
		return *this;
	}
	constexpr bool operator==(const modint rhs) const {
		return val == rhs.val;
	}
	constexpr bool operator!=(const modint rhs) const {
		return val != rhs.val;
	}
	constexpr bool operator<(const modint rhs) const {
		return val < rhs.val;
	}
	constexpr bool operator>(const modint rhs) const {
		return val > rhs.val;
	}
	constexpr bool operator<=(const modint rhs) const {
		return val <= rhs.val;
	}
	constexpr bool operator>=(const modint rhs) const {
		return val >= rhs.val;
	}
	friend ostream& operator<<(ostream& os, const modint<Mod>& m){
		return os << m.val;
	}
	friend istream& operator>>(istream& is, modint<Mod>& m){
		return is >> m.val;
	}
	static constexpr modint inv(modint m){
		Int a = m.val, b = Mod, u = 1, v = 0;
		while(b){
			Int t = a / b;
			a -= t * b;
			swap(a, b);
			u -= t * v;
			swap(u, v);
		}
		u %= Mod;
		if(u < 0) u += Mod;
		return modint(u);
	}
	static vector<modint> fact;
	static constexpr modint comb(Int n, Int r){
		if(n < 0 || r < 0 || n - r < 0) return 0;
		while(Int(fact.size()) <= n)
			fact.push_back(fact.back() * modint(fact.size()));
		return fact[n] / fact[r] / fact[n-r];
	}
	constexpr operator Int() const {
		return val;
	}
};
template<Int Mod> vector<modint<Mod>> modint<Mod>::fact = vector<modint<Mod>>(1, 1);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int n, k; cin >> n >> k;
	using mint = modint<>;
	for(Int i=1; i<=k; ++i){
		mint ans = mint::comb(n-k+1, i) * mint::comb(k-1, i-1);
		cout << ans << "\n";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill( x, y ) memset( x, y, sizeof x )
#define copy( x, y ) memcpy( x, y, sizeof x )
using namespace std;

typedef long long LL;
typedef pair < int, int > pa;
typedef vector < int > vec;

const int MAXN = 2005;

int n, a[MAXN], c[MAXN][MAXN];
vec e[MAXN];
bool vis[MAXN];

inline void dfs(int x)
{
	vis[ x ] = 1;
	for( int i = 0 ; i < n ; i++ ) if( c[ x ][ i ] ) if( !vis[ i ] ) e[ x ].pb( i ), dfs( i );
}

inline vec solve(int x)
{
	vector < vec > cur;
	vec ret;
	for( auto y : e[ x ] )
	{
		vec t = solve( y );
		reverse( t.begin(), t.end() );
		cur.pb( t );
	}
	if( x ^ n ) ret.pb( a[ x ] );
	while( true )
	{
		int x = -1;
		for( int i = 0 ; i < cur.size() ; i++ )
			if( !cur[ i ].empty() && ( x == -1 || cur[ i ].back() > cur[ x ].back() ) ) x = i;
		if( x == -1 ) break;
		ret.pb( cur[ x ].back() );
		cur[ x ].pop_back();
	}
	return ret;
}

int main()
{
#ifdef wxh010910
	freopen( "data.in", "r", stdin );
#endif
	scanf( "%d", &n );
	for( int i = 0 ; i < n ; i++ ) scanf( "%d", &a[ i ] );
	sort( a, a + n );
	for( int i = 0 ; i < n ; i++ )
		for( int j = 0 ; j < i ; j++ )
			if( __gcd( a[ i ], a[ j ] ) ^ 1 )
				c[ i ][ j ] = c[ j ][ i ] = 1;
	for( int i = 0 ; i < n ; i++ ) if( !vis[ i ] )
		e[ n ].pb( i ), dfs( i );
	vec ans = solve( n );
	for( auto x : ans ) printf( "%d ", x );
	return putchar( 10 ), 0;
}


Measured memory_bytes: 16256
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 100005;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
map<pair<int,int> ,int> mm;

#define Se second
#define Fi first

int n,m;
int  l,r,d;
int book[maxn];
int num[maxn];
int flag;

vector<int> v[maxn];

void dfs(int x)
{
    if(flag==1)
        return ;
    for(int i=0;i<v[x].size();i++)
    {
        int pos=v[x][i];
         if(book[pos]==0)
         {
             book[pos]=1;
             num[pos]=num[x]+mm[pair<int,int>(x,pos)];
             dfs(pos);
         }
         else
         {
             if(num[pos]!=num[x]+mm[pair<int,int>(x,pos)])
             {
                 flag=1;
                 return ;
             }
         }
    }
    return ;
}
int main()
{
    cin>>n>>m;
    flag=0;
    while(m--)
    {
        cin>>l>>r>>d;
        v[l].push_back(r);
        v[r].push_back(l);
        mm[pair<int,int>(l,r)]=d;
        mm[pair<int,int>(r,l)]=-d;
    }
    for(int i=1;i<=n;i++)
    {
        if(flag==1)
            break;
        if(book[i]==0)
        {
            book[i]=1;
            num[i]=0;
            dfs(i);
        }
    }
    if(flag==1)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 40064
#include <iostream>
#include <vector>

using namespace std;




int main(void) {
  vector<int> TAKOYAKI(100, 0);
  int N;

  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> TAKOYAKI[i];
  }
  

  int Ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i+1; j < N; j++) {
      Ans += TAKOYAKI[j] * TAKOYAKI[i];
    }
  }
  cout << Ans << endl;

  
  return 0;
}


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

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            double N = double.Parse(s[0]);
            double K = double.Parse(s[1]);

            double answer = 0;

            if (N >= K)
            {
                answer += (N - K + 1) / N;
            }

            for(int i = 1; i <= Math.Min(N,(int)K - 1); i++)
            {
                double score = i;
                double count = 0;

                while(K > score)
                {
                    score *= 2;
                    count++;
                }

                answer += (1 / N) * Math.Pow(0.5, count);
            }

            Console.WriteLine(answer);
        }
    }
}

Measured memory_bytes: 27872
#include <iostream>
#include <vector>
#include <stack>

#define FOR(i,n) for(int i=0;i<n;i++)

using namespace std;

void makeStackRecur(vector<vector<int> > &g, int u, stack<int> &out, vector<bool> &seen) {
    seen[u] = true;
    for(int v: g[u])
        if (! seen[v])
            makeStackRecur(g, v, out, seen);
    out.push(u);
}

void makeStack(vector<vector<int> > &g, int u, vector<bool> &seen, stack<int> &vStack) {
    makeStackRecur(g, u, vStack, seen);
}
void getConnectedCompRecur(vector<int> &rootGroup, vector<vector<int> > &invGraph, int u, int root) {
    if (rootGroup[u] == -1) {
        rootGroup[u] = root;
        for(int v: invGraph[u])
            getConnectedCompRecur(rootGroup, invGraph, v, root);
    }
}

void getConnectedComp(vector<int> &rootGroup, vector<vector<int> > &invGraph, stack<int> &vStack) {
    while (! vStack.empty()) {
        int u = vStack.top();
        vStack.pop();
        getConnectedCompRecur(rootGroup, invGraph, u, u);
    }
}
int main () {
    int V, E;
    cin >> V >> E;

    vector<vector<int> > graph(V);
    vector<vector<int> > invGraph(V);
    vector<bool> seen(V, false);
    vector<int> rootGroup(V, -1);

    FOR(i,E) {
        int s, t;
        cin >> s >> t;

        graph[s].push_back(t);
        invGraph[t].push_back(s);
    }

    stack<int> vStack;
    FOR(i, V)
        if (! seen[i]) makeStack(graph, i, seen, vStack);

    FOR(i, V)
        if (rootGroup[i] == -1) getConnectedComp(rootGroup, invGraph, vStack);

    int Q;
    cin >> Q;
    FOR(i,Q) {
        int f, t;
        cin >> f >> t;
        cout << (rootGroup[f] == rootGroup[t]) << endl;
    }
}



Measured memory_bytes: 4676
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func readLine(r *bufio.Reader) []byte {
	buf := make([]byte, 0, 1024)
	for {
		l, p, e := r.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return buf
}

//
// セグメント木
//
type segTree []int

const segTreeDefault = 0

// マージ関数
func (s *segTree) segMerge(a, b int) int {
	if a > b {
		return a
	}
	return b
}

/*
func (s *segTree) segMerge(a,b, int) int {
	return a+b
}
*/

func segTreeInit(N int) segTree {
	size := 1
	for N > size {
		size <<= 1
	}
	s := make(segTree, size*2)
	for i := 0; i < size*2; i++ {
		s[i] = segTreeDefault
	}
	s[0] = 0
	return s
}

func (s *segTree) set(i, pos int) {
	N := len(*s)/2 + pos
	(*s)[N] = i
	for N > 1 {
		N /= 2
		(*s)[N] = s.segMerge((*s)[2*N], (*s)[2*N+1])
	}
}

func (s *segTree) setAll(a []int, n int) {
	N := len(*s) / 2
	for i := 0; i < n; i++ {
		(*s)[N+i] = a[i]
	}
	for N > 1 {
		N >>= 1
		for i := 0; i < N; i++ {
			pos := N + i
			(*s)[pos] = s.segMerge((*s)[2*pos], (*s)[2*pos+1])
		}
	}
}

func (s *segTree) querySub(l, r, index, L, R int) int {
	if R <= l || r <= L {
		return segTreeDefault
	}
	if l <= L && R <= r {
		return (*s)[index]
	}
	med := (L + R) / 2
	lval := s.querySub(l, r, index*2, L, med)
	rval := s.querySub(l, r, index*2+1, med, R)
	return s.segMerge(lval, rval)
}

// queryの区間は[l, r)です
func (s *segTree) query(l, r int) int {
	return (*s).querySub(l, r, 1, 0, len(*s)/2)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	N := getInt()
	S := []byte(getString())

	seg := make([]segTree, 26)
	for i := 0; i < 26; i++ {
		seg[i] = segTreeInit(N)
	}

	for i, v := range S {
		val := v - 'a'
		seg[val].set(1, i)
	}

	Q := getInt()

	for i := 0; i < Q; i++ {
		t := getInt()
		if t == 1 {
			i := getInt() - 1
			c := getString()
			p := S[i]
			S[i] = c[0]
			seg[p-'a'].set(0, i)
			seg[c[0]-'a'].set(1, i)
		} else {
			l, r := getInt()-1, getInt()
			ans := 0
			for i := 0; i < 26; i++ {
				ans += seg[i].query(l, r)
			}
			out(ans)
		}
	}

}


Measured memory_bytes: 222592
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int r, c, k;
    cin >> r >> c >> k;
    vector<string> g(r, string(c, '#'));
    for(int y=0; y<r; ++y){
        for(int x=0; x<c; ++x){
            cin >> g[y][x];
        }
    }

    ++ k;
    vector<vector<bool> > dp(r, vector<bool>(c, false));
    vector<int> add(c);
    deque<int> sub(r+c);
    for(int y=0; y<r; ++y){
        int sum = 0;
        for(int x=0; x<c; ++x){
            if(0 <= y - k && g[y-k][x] == '.' && !dp[y-k][x]){
                -- add[x];
                -- sub[y+x-k];
            }

            sum += add[x];
            if(0 <= y + x - k)
                sum -= sub[y+x-k];

            if(g[y][x] == '.'){
                if(sum > 0){
                    dp[y][x] = true;
                }
                else{
                    ++ add[x];
                    ++ sub[y+x];
                    ++ sum;
                }
            }
        }
    }

    if(dp[r-1][c-1])
        cout << "Chieno" << endl;
    else
        cout << "Cacao" << endl;

    return 0;
}


Measured memory_bytes: 2408
#include<bits/stdc++.h>
using namespace std;
#define int  long long 
#define speedrap ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int be(int a,int b,int mod) {if(b == 0) return 1; if(b%2 == 1) return (a*be(a,b-1,mod))%mod; else return (be(a,b/2,mod)*be(a,b/2,mod))%mod;}
const int mod = 2019;
#define PI 3.14159265359
#define pf push_front
#define pb push_back
#define bitcount __builtin_popcount
#define sc(a) scanf("%d", &a);
#define sz(s) (int)s.size()
#define eb emplace_back
#define pf push_front
#define mkp(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
const int siz = 2*(1e5 + 1);
const int logi = 21;
const double epsilon = 1e-6;
int prime[siz];
bool cmp(const int &a,const int &b)
{
  return (abs(a-b)>1);
}


signed main()
{
	#ifndef ONLINE_JUDGE
 	freopen("in.txt", "r", stdin);
 	freopen("out.txt", "w", stdout);
 	#else
// // online submission
 	#endif 
	speedrap
	int t;
	t = 1;
	//cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		set<string> s;

		for(int i = 0 ; i < n ; i++)
		{
			string g;
			cin>>g;
			s.insert(g);
		}

		cout<<s.size();
	}
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin>>n; int a[n],dp[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    dp[0]=0;dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min((dp[i-1]+abs(a[i]-a[i-1])),(dp[i-2]+abs(a[i]-a[i-2])));
    }
    cout<<dp[n-1];
    return 0;
}

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

int main(){
	int left, right, l, r, n, m;
	cin >> n >> m;
	left = 1;
	right = n;
	for(int i=0; i<m; i++){
		cin >> l >> r;
		left = max(left, l);
		right = min(right, r);
	}
	cout << max(0, right-left+1) << endl;
	return 0;
}

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

struct Sieve {
  int n;
  vector<int> f, primes;

  Sieve(int n = 1) : n(n), f(n + 1) {
    f[0] = f[1] = -1;
    for (long long i = 2; i <= n; ++i) {
      if (f[i] != 0) continue;
      primes.push_back(i);
      f[i] = i;
      for (long long j = i * i; j <= n; j += i) {
        if (f[j] == 0) f[j] = i;
      }
    }
  }

  bool isPrime(int x) { return f[x] == x; }

  map<int, int> factor(int x) {
    map<int, int> mp;
    while (x != 1) {
      mp[f[x]]++;
      x /= f[x];
    }
    return mp;
  }
};

int main(){
  int N; cin >> N;
  const int Amax = 1000000;
  map<int, int> mp;
  rep(i, N) {
    int A; cin >> A;
    mp[A]++;
  }
  int ans = 0;
  vector<int> vec(Amax + 1, -1);
  for (auto p : mp) {
    long long x, t; tie(x, t) = p;
    if (vec[x] != -1) continue;
    if (t == 1) ans++;
    for (long long i = x; i <= Amax; i += x) vec[i] = 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 16440