akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}
#define maxn 100007
int k,dis[maxn];
bool inq[maxn];
queue<int>q;
inline void relax(int u,int v,int w){
	if(dis[v]>dis[u]+w){
		dis[v]=dis[u]+w;
		q.push(v);
		if(!inq[v])inq[v]=1,q.push(v);
	}
} 
int spfa()
{
	memset(dis,63,sizeof dis);
	dis[1]=1;q.push(1);
	while(!q.empty())
	{
		int u=q.front();q.pop();inq[u]=0;
		relax(u,(u+1)%k,1);
		relax(u,u*10%k,0);
	}return dis[0];
}
int main()
{
	k=read();
	cout<<spfa(); 
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

int main()
{
	int a, b;
	std::cin >> a >> b;

	if(a < b) {
		std::cout << "a < b" << std::endl;
	} 
	
	if(a > b) {
		std::cout << "a > b" << std::endl;
	}

	if(a == b) {
		std::cout << "a == b" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1156
N = int(input())
a = list(map(int, input().split()))
s = [0 for i in range(N+1)]
for i in range(N):
    s[i+1] = s[i] + a[i]
#s[i+1]にはa[0]からa[i]までの総和

dic = {}
for i in range(N+1):
    if dic.get(s[i]) == None:
        dic[s[i]] = 1
    else:
        dic[s[i]] += 1

ans = 0
for k in dic:
    ans += dic[k]*(dic[k]-1)/2

print(int(ans))

Measured memory_bytes: 41144
#! /usr/bin/env python3

alp = 'abcdefghijklmnopqrstuvwxyz'
S = input()
if S == alp[::-1]:
    print(-1)
else:
    if len(S) == len(alp):
        l = list(S)
        s = []
        for i in range(1, len(S))[::-1]:
            s += [l[i]]
            r = sorted(x for x in s if x > l[i-1])
            if r:
                l = l[:i-1] + [r[0]]
                break
        print(''.join(l))
    else:
        for i in S : alp = alp.replace(i, '')
        print(S+alp[0])

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

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    s1 = toupper(s1[0]);
    s2 = toupper(s2[0]);
    s3 = toupper(s3[0]);

    cout << s1 << s2 << s3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> void read(T& x)
{
	char c = getchar(); T p = 1, n = 0;
	while(c < '0' || c > '9') {if(c == '-') p = -1; c = getchar();}
	while(c >= '0' && c <= '9'){n = n * 10 + c - '0'; c = getchar();}
	x = p * n;
}
template<class T,class U>void read(T&x,U&y){read(x),read(y);}
const int maxn = 5000, mod = 924844033;
bool vis[maxn][2], ed[maxn];
int f[maxn][maxn][2], g[maxn], fac[maxn];
int main()
{
	int n, k; read(n, k);
	int tot = 0;
	for(int i = 1; i <= n; ++i) for(int j = 0; j < 2; ++j) if(!vis[i][j])
	{
		int len = 0;
		for(int x = i, y = j; x <= n; x += k, y ^= 1)
			vis[x][y] = true, ++len;
		ed[tot += len] = 1;
	}
	f[1][0][0] = 1;
	for(int i = 1; i <= tot; ++i) for(int j = 0; j <= n; ++j)
	{
		f[i + 1][j][0] = (f[i][j][0] + f[i][j][1]) % mod;
		if(!ed[i]) f[i + 1][j + 1][1] = f[i][j][0];
	}
	for(int i = 0; i <= n; ++i) g[i] = (f[tot][i][0] + f[tot][i][1]) % mod;
	fac[0] = 1; for(int i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
	int ret = fac[n];
	for(int i = 1, m = mod - 1; i <= n; ++i, m = mod - m)
		ret = (ret + 1ll * g[i] * m % mod * fac[n - i] % mod) % mod;
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 157056
package main

import (
  "fmt"
)

func main() {
  var N, sum  int
  fmt.Scan(&N)

  A := make([]int, N)
  B := make([]int, N)
  C := make([]int, N-1)
  for i := 0; i < N; i++ {
    fmt.Scan(&A[i])
  }
  for i := 0; i < N; i++ {
    fmt.Scan(&B[i])
    sum += B[i]
  }
  for i := 0; i < N-1; i++ {
    fmt.Scan(&C[i])
  }

  for i := 1; i < N; i++{
    if A[i - 1] + 1 == A[i] {
      sum += C[A[i - 1] - 1]
    }
  }
  fmt.Println(sum)

}


Measured memory_bytes: 512
import sys

read = sys.stdin.read
readline = sys.stdin.readline

K, *A = map(int, read().split())
maximum = 2
minimum = 2
for i in A[::-1]:
    if maximum // i - (minimum - 1) // i >= 1:
        maximum = maximum // i * i + i - 1
        minimum = (minimum + i - 1) // i * i
    else:
        print(-1)
        exit()

print(minimum, maximum)


Measured memory_bytes: 14092
#include <string>
#include <map>
#include <iostream>


using namespace std;



int main()
{
	
	int c;
	cin >> c;
	map<string, int> name_map;
	for (int i = 0; i < c; i++)
	{
		string s;
		cin >> s;
		name_map[s] = 1;
		
	}

	cout << name_map.size();
	return 0;
}

Measured memory_bytes: 19188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int main(){int x,y,a,b,c; cin>>x>>y>>a>>b>>c; long long d=0; vector<int> p(a),q(b),r(c); rep(i,a) cin>>p[i]; rep(i,b) cin>>q[i]; rep(i,c) cin>>r[i]; sort(p.rbegin(),p.rend()); sort(q.rbegin(),q.rend()); rep(i,x) r.push_back(p[i]); rep(i,y) r.push_back(q[i]); sort(r.rbegin(),r.rend()); rep(i,x+y) d+=r[i]; cout<<d;}

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

using namespace std;

int main(){
  int N,T,sum=0;
  cin >> N >> T;
  vector<int> t(N);
  for(int i=0;i<N;i++){
    cin >> t[i];
  }
  for(int j=1;j<N;j++){
    if(t[j]-t[j-1]<T){
      sum += t[j]-t[j-1];
    }else{
      sum += T;
    }
  }
  sum += T;
  cout << sum << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef int64_t llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64

int main(){
    int n;
    cin >> n;
    set<int> st;
    int tmp;
    REP(i,n){
        scanf("%d",&tmp);
        if(st.erase(tmp)==0) st.insert(tmp);
    }
    cout << st.size() << endl;
}


Measured memory_bytes: 4864
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iomanip>
using namespace std;


int main() {
	int n;
	int element;
	bool ans = true;
	cin >> n;
	int count = 0;
	while (count < n) {
		cin >> element;
		if (element % 2 == 0) {
			if (element % 5 == 0 || element % 3 == 0) {
				ans = true;
			}
			else {
				ans = false;
				break;
			}
		}
		count++;
	}
	if (ans) {
		cout << "APPROVED" << endl;
	}
	else {
		cout << "DENIED" << endl;
	}
}





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

using namespace std;

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

int x, y, z, a, b, c;

struct person {
	ll a, b;
	person() {};
	person(ll _a, ll _b, ll _c) {
		a = _a - _c;
		b = _b - _c;
	};

	bool operator<(const person &rhs) const {
		return a - b < rhs.a - rhs.b;
	}
};
person p[100001];

multiset<int> h1, h2, used;

ll fn = -1e18, f1 = 0 , f2 = 0;

void cl(int idx) {
	if(used.find(p[idx].b) != used.end())
		used.erase(used.find(p[idx].b));
	else if (h2.find(p[idx].b) != h2.end()) {
		f2 -= p[idx].b;
		h2.erase(h2.find(p[idx].b));
	}
	while (h2.size() < y) {
		h2.insert(*(--used.end()));
		f2 += *(--used.end());
		used.erase(--used.end());
	}
}
int main() {
	//freopen("input.txt", "r", stdin);
	scanf("%d%d%d", &x, &y, &z);
	ll ans = 0;
	for (int i = 0; i < x + y + z; ++i) {
		scanf("%d%d%d", &a, &b, &c);
		p[i] = person(a, b, c);
		used.insert(p[i].b);
		ans += c;
	}
	sort(p, p + (x + y + z));
	reverse(p,p+(x+y+z));
	for (int i = 0; i + y < (x + y + z); ++i) {
		f1 += p[i].a;
		h1.insert(p[i].a);
		while (h1.size() > x) {
			f1 -= *h1.begin();
			h1.erase(h1.begin());
		}
		cl(i);
		if (i >= x - 1){
			fn = max(f1 + f2, fn);
		}
	}

	printf("%lld\n", fn + ans);
	return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
struct Node
{
	int value;
   Node* prev,* next;
};
Node* head;
void Init()
{
    head=(Node*)malloc(sizeof(Node));
    head->next=head;
    head->prev=head;
}

Node* FindNode(int x)
{
	Node*temp=head->next;
	while(temp!=head&&temp->value!=x)
        temp=temp->next;
    return temp;
}
void Insert(int x)
{
	Node*temp=(Node*)malloc(sizeof(Node));
    temp->value=x;
    head->next->prev=temp;
    temp->next=head->next;
    head->next=temp;
    temp->prev=head;
}

void Delete(Node*temp)
{
	if(temp==head)
        return ;
	temp->next->prev=temp->prev;
	temp->prev->next=temp->next;
    free(temp);
}

void DeleteFirst()
{
    Delete(head->next);
}
void DeleteLast()
{
	Delete(head->prev);
}
/*
void PrintList()
{
    /*
    Node*temp=head->next;
    int flag=0;
    while(1)
    {
        if(temp==head)
            break;
        else
        {
            if(flag++>0)
                printf(" ");
            printf("%d",temp->value);
            temp=temp->next;
        }
    }
    printf("\n");
    
     Node* temp=head->next;
    while(temp->next!=head)
    {
        printf("%d ",temp->value);
        temp=temp->next;
    }
    printf("%d\n",temp->value);
}
*/
int main()
{
	int n;
	int i;
	scanf("%d",&n);
	char str[12];
	int x;
	Init();
    /*
	while(n--)
	{
		scanf("%s%d",str,&x);
		if(str[0]=='i'){Insert(x);}
		else if(str[0]=='d'&&str[6]=='F')DeleteFirst();
		else if(str[0]=='d'&&str[6]=='L')DeleteLast();
		else if(str[0]=='d'){Delete(FindNode(x));}
	}
    */

	for(i = 0; i < n; i++) {
        scanf("%s %d", str, &x);
        if (str[0] == 'i') {
            Insert(x);
        }
        else if(str[0] == 'd') {
            if(str[6] == 'F')
                DeleteFirst();
            else if(str[6] == 'L')
                DeleteLast();
            else
                //DeleteValue(x);
                Delete(FindNode(x));
        }
    }
    
    Node* temp=head->next;
    while(temp->next!=head)
    {
        printf("%d ",temp->value);
        temp=temp->next;
    }
    printf("%d\n",temp->value);
    
    //PrintList();
	return 0;
}

Measured memory_bytes: 34456
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	char c[10];
	cin >> a >> c[0] >> b;
	if(c[0]=='+'){
		cout << a+b << endl;
	}else{
		cout << a-b << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000009;
const double pi = acos(-1);

int main() {
    int A,B,C; cin >> A >> B >> C;
    cout << (A+B >= C ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#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())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	int n;
	cin >> n;

	vector<pair<ll, ll>>r(n);
	vector<pair<ll, ll>>itv(n);

	REP(i, n) {
		cin >> r[i].first >> r[i].second;
		itv[i].first = r[i].first + r[i].second;//終良
		itv[i].second = r[i].first - r[i].second;//開始
	}

	SORT(itv);

	/*for (int i = 0; i < n; i++) {
		cout << itv[i].first <<" "<< itv[i].second << endl;
	}*/

	int ans = 0;
	ll x = -1000000000;

	for (int i = 0; i < n; i++) {
		if (x <= itv[i].second) {
			ans++;
			//cout << i << endl;
			x = itv[i].first;
		}
	}

	cout << ans << endl;
	

	return 0;

}

Measured memory_bytes: 3456
#include<iostream>
int main()
{
	int v1, v2, v3;
	std::cin >> v1 >> v2 >> v3;
	if ( v1 <= v2 && v2 <= v3 )
	{
			std::cout << v1 << " " << v2 << " " << v3 << std::endl;
	}
	else
	{
		if ( v1 <= v3 && v3 <= v2 )
		{
			std::cout << v1 << " " << v3 << " " << v2 << std::endl;
		}
		else
		{
			if ( v2 <= v1 && v1 <= v3 )
			{
				std::cout << v2 << " " << v1 << " " << v3 << std::endl;
			}
			else
			{
				if ( v2 <= v3 && v3 <= v1 )
				{
					std::cout << v2 << " " << v3 << " " << v1 << std::endl;
				}
				else
				{
					if ( v3 <= v1 && v1 <= v2 )
					{
						std::cout << v3 << " " << v1 << " " << v2 << std::endl;
					}
					else
					{
						std::cout << v3 << " " << v2 << " " << v1 << std::endl;
					}
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ieps (int) 1e6
#define eps (int) 1e9
#define pii pair<int,int>


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

int lcm(int a,int b)
{
    return a/gcd(a,b)*b;
}

int32_t main(){
	int n;
	cin>>n;
	int currresp = 1LL;
	int currgcd = 1LL;
	for(int i = 0;i<n;i++){
		int x;
		cin>>x;
		currresp = lcm(currresp , x);
	}
	cout<<currresp<<endl;

}

Measured memory_bytes: 256
///////////////////////Loading Payloads.......////////////////////////////
#include<bits/stdc++.h>
#define f(i,a,b) for(int i = a; i < b; i++)
#define fd(i,a,b) for(int i = a; i > b;i--)
#define ll long long
#define fl(i,a,b) for(ll i = a; i < b; i++)
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VS vector<string>
#define VL vector<long long>
#define VC vector<char>
#define VF vector<float>
#define PB push_back
#define F first
#define S second
#define fa(i,skill) for(auto i : skill)
#define fr(i,skill) for(VI :: reverse_iterator i = skill.rbegin(); i != skill.rend(); i++)
#define PI pair<int,int>
using namespace std;

///////////////////////Engine Check.......////////////////////////////
void edit(VI &skill,int n)
{
    f(i,0,n)
        {
            int x;
            cin >> x;
            skill.PB(x);
        }	
}

void achilles()
{
	float d,t,s;cin >> d >> t >> s;
	if((d/s) <= t) cout << "Yes\n";
	else cout << "No\n";
	
}
///////////////////////3....2....1...Ignition////////////////////////////

int main()
{
	ios :: sync_with_stdio(0);
	cin.tie(0);
	/*int t;cin >> t;
	while(t--)*/
    achilles();
    return 0;
}


Measured memory_bytes: 3744
x,y,a,b,c=map(int,input().split())

p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
r=sorted(r)

p.extend(q)
p=sorted(p)

ans=0
for i in range(x+y):
    if len(r)>0:
        if p[-1]<r[-1]:
            ans+=r[-1]
            r.pop(-1)
        else:
            ans+=p[-1]
            p.pop(-1)
    else:
        ans+=p[-1]
        p.pop(-1)
        
print(ans)



Measured memory_bytes: 23328
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int a[100],len,K;
long ans=0;
int solve(int k,int s){
	if(s==len)return 0;
	if(a[s]==0)return solve(k,s+1);
	if(k==1)return a[s]+9*(len-1-s);
	else if(k==2){
		return (len-1-s)*(len-2-s)/2*81
				+(len-1-s)*(a[s]-1)*9
				+solve(k-1,s+1);
	}else if(k==3){
		return (len-1-s)*(len-2-s)*(len-3-s)/6*729
				+(len-1-s)*(len-2-s)/2*81*(a[s]-1)
				+solve(k-1,s+1);
	}else return 0;
}
int main(){

	string S;
	cin>>S>>K;
	len=S.length();
	for(int i=0;i<len;i++)a[i]=S[i]-'0';
	
	cout<<solve(K,0);
	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int sum_num(int a)
{
    int s = 0;
    while (a)
    {
        s += a % 10;
        a /= 10;
    }
    return s;
}

int main()
{
    int n, y;
    cin >> n >> y;
    int num10000 = y / 10000;
    int num5000 = y / 5000;
    rep(i, num10000 + 1)
    {
        rep(j, num5000 + 1)
        {
            int num1000 = y / 1000 - i * 10 - j * 5;
            if (0 <= num1000 && num1000 <= y / 1000 + 1 && i + j + num1000 == n)
            {
                printf("%d %d %d\n", i, j, num1000);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}


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

using namespace std;

#define ll 			long long
#define db			double
#define up(i,j,n)		for (int i = j; i <= n; i++)
#define down(i,j,n)	for (int i = j; i >= n; i--)
#define cadd(a,b)		a = add (a, b)
#define cpop(a,b)		a = pop (a, b)
#define cmul(a,b)		a = mul (a, b)
#define pr			pair<int, int>
#define fi			first
#define se			second
#define SZ(x)		(int)x.size()
#define bin(i)		(1 << (i))
#define Auto(i,node)	for (int i = LINK[node]; i; i = e[i].next)

template<typename T> inline bool cmax(T & x, T y){return y > x ? x = y, true : false;}
template<typename T> inline bool cmin(T & x, T y){return y < x ? x = y, true : false;}
template<typename T> inline T dmax(T x, T y){return x > y ? x : y;}
template<typename T> inline T dmin(T x, T y){return x < y ? x : y;}

const int MAXN = 105;
const int oo = 0x3f3f3f3f;

int N;

struct edge {
	int y, next;
}e[MAXN << 1];

int LINK[MAXN], len = 0, dis[MAXN], pre[MAXN];

inline void ins(int x, int y){
	e[++len].next = LINK[x]; LINK[x] = len;
	e[len].y = y;
}

inline void Ins(int x, int y){
	ins(x, y);
	ins(y, x);
}

deque<int> q;

int BFS(int ss){
	up (i, 1, N) dis[i] = oo;
	dis[ss] = 0; q.push_back(ss);
	while (!q.empty()) {
		int node = q.front(); q.pop_front();
		Auto (i, node) if (dis[e[i].y] > dis[node] + 1) {
			dis[e[i].y] = dis[node] + 1;
			pre[e[i].y] = node;
			q.push_back(e[i].y);
		}
	}
	int tt = ss;
	up (i, 1, N) if (dis[i] > dis[tt]) tt = i;
	return tt;
}

bool vis[MAXN];

int mx[MAXN];
pr w[MAXN];

void DFS(int node, int dep){
	int deg = 0; vis[node] = 1;
	Auto (i, node) if (!vis[e[i].y]) {
		deg++;
		DFS(e[i].y, dep + 1);
	}
	cmax(mx[dep], deg);
}

int main(){
#ifdef cydiater
	freopen("input.in", "r", stdin);
#endif
	scanf("%d", &N);
	up (i, 2, N) {
		int x, y; scanf("%d%d", &x, &y);
		Ins(x, y);
		w[i] = make_pair(x, y);
	}
	int ss = BFS(1), tt = BFS(ss), len = dis[tt];
	len++;
	printf("%d ", (len + 1) >> 1);
	ll fans = 1e18;
	if (len % 2 == 1) {
		int q, d = len / 2;
		for (q = tt; d--; q = pre[q]);
		DFS(q, 1); 
		ll ans = 1;
		up (i, 1, len / 2) ans *= mx[i];
		cmin(fans, ans);
		len++;
	}
	up (o, 2, N) {
		int p = w[o].fi, q = w[o].se;
		up (i, 1, len / 2) mx[i] = 0;
		up (i, 1, N) vis[i] = 0;
		vis[p] = vis[q] = 1;
		DFS(p, 1); DFS(q, 1);
		if (mx[len / 2] > 0) continue;
		ll cur = 1;
		up (i, 1, len / 2 - 1) cur *= mx[i];
		cmin(fans, cur << 1);
	}
	printf("%lld\n", fans);
	return 0;
}



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

R=[]
for i in range(n):
    R.append(int(input()))

maxv=-1000000000
minv=R[0]
for i in range(1,len(R)):
    maxv=max(maxv,R[i]-minv)
    minv = min(minv, R[i])
print(maxv)



Measured memory_bytes: 13588
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <tuple>

using namespace std;

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


string tostr(int i) {
	stringstream ss;
	ss << i;
	return ss.str();
}

int toint(string s) {
	stringstream ss(s);
	int i;
	ss >> i;
	return i;
}


class UF {

private:

	vector<vector<int>> elmList;

public:

	int groups;
	vector<int> par, rank, elm;



	UF(int __size) :par(__size), rank(__size, 0), elm(__size, 1), groups(__size), elmList(__size) {

		rep(i, __size)elmList[i] = vector<int>(1, i);

		rep(i, __size)par[i] = i;

	}

	int find(int x) {

		if (par[x] == x) {

			return x;

		}
		else {

			return par[x] = find(par[x]);

		}

	}



	void unite(int x, int y) {

		x = find(x);

		y = find(y);

		if (x == y)return;



		groups--;

		if (rank[x] < rank[y]) {

			par[x] = y;

			elm[y] += elm[x];

			for (auto &e : elmList[x])elmList[y].push_back(e);

		}
		else {

			par[y] = x;

			elm[x] += elm[y];

			for (auto &e : elmList[y])elmList[x].push_back(e);

			if (rank[x] == rank[y])rank[x]++;

		}

	}

	bool isSame(int x, int y) {

		return find(x) == find(y);

	}

};

typedef tuple<double, int, int> T;

signed main() {

	int n, m;
	cin >> n >> m;

	vector<int> a(m), b(m), c(m), d(m);

	rep(i, m) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}

	auto ok = [&](double x) {
		vector<T> v;

		double cost_sum = 0;
		rep(i, m) {
			v.push_back(T(double(d[i]) - c[i] * x, a[i], b[i]));
			cost_sum += double(d[i]) - c[i] * x;
		}
		sort(v.begin(), v.end());
		reverse(v.begin(), v.end());

		UF uf(n);

		double cost_count = 0;

		rep(i, m) {
			double cost = get<0>(v[i]);
			int a = get<1>(v[i]);
			int b = get<2>(v[i]);

			if (!uf.isSame(a, b)) {
				uf.unite(a, b);
				cost_count += cost;
			}

			if (uf.groups == 1) {
				break;
			}
		}

		return cost_sum - cost_count <= 1e-9;
	};

	double l = 0.0, r = 1e9;

	rep(i, 100) {
		double m = (l + r) / 2.0;
		if (ok(m)) {
			r = m;
		}
		else {
			l = m;
		}
	}

	printf("%.8lf", l);
	return 0;
}

Measured memory_bytes: 4412
/*
Author : N_o_o_B
Created : December 22 2019 17:38:27 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    ll n;
    cin >> n;
    if(n&1){
        cout << 0 << endl;
        return 0;
    }
    ll mul = 10;
    ll ans = 0;
    while(n >= mul){
        ans += n/mul;
        mul *= 5;
    }
    cout << ans << endl;
    time_taken();
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int ans = 0;
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += a[i];
        }
        for (int i = 0; i < n; i++) {
            if (a[i] * 4 * m >= sum) {
                ++ans;
            }
        }
        if (ans >= m) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 22996
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int n,xx,yy,zz,b[110000],be[110000],et;
struct edg{
	int y,z,ne;
}e[210000];
inline void add_edge(int x,int y,int z){
	e[++et].y=y;
	e[et].z=z;
	e[et].ne=be[x];
	be[x]=et;
}
void dfs(int x,int fa){
	for(int i=be[x];i;i=e[i].ne) if (e[i].y!=fa){
		if (e[i].z&1) b[e[i].y]=b[x]^1;else b[e[i].y]=b[x];
		dfs(e[i].y,x);
	}
}
int main(){
	scanf("%d",&n);
	fo(i,2,n){
		scanf("%d%d%d",&xx,&yy,&zz);
		add_edge(xx,yy,zz);
		add_edge(yy,xx,zz);
	}
	dfs(1,0);
	fo(i,1,n) printf("%d\n",b[i]);
	return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){
  int A, B, C, X, Y;
  cin >> A >> B >> C >>  X >> Y;
  int ans = INF;
  REP(i, max(X, Y)*2+1){
    int dx = max(X - i/2, 0), dy = max(Y - i/2, 0);
    int cost = A * dx + B*dy + C * i;
    // cerr << "i:" << i << " dx:" << dx << " dy:" << dy << " cost:" << cost << endl;
    ans = min(ans, cost);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
bool query(long long x){
    cout<<"? "<<x<<endl;
    string y;
    cin>>y;
    cout.flush();
    if(y=="Y"){
        return true;
    }
    return false;
}
int main(){
    long long dig = 1e9;
    if(!query(dig)){
        while(!query(dig)){
            dig/=(long long)10;
        }
        long long l = dig;
        long long r = ((long long)10*dig)-1;
        long long ans = 0;
        while(l<=r){
            long long mid = (l+r)/2;
            if(query((long long)10*mid)){
                r= mid-1;
                ans =mid;
            }else{
                l=mid+1;
            }
        }
        cout<<"! "<<ans<<endl;
    }else{
        long long ans = 10;
        while(!query(ans-1)){
            ans*=(long long)10;
        }
        ans/=(long long)10;
        cout<<"! "<<ans<<endl;
    }
}


Measured memory_bytes: 596
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())
 
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const ll MOD = (ll)1000000007;//10^9+7
const ll INF2 = (ll)100000000000000000;//10^18


int main() {
    ll H,W,N;
    cin>>H>>W>>N;
    vector<PII> x(N);
    REP(i,N){
        int a,b;
        cin>>a>>b;
        a--; b--;
        x[i]= make_pair(a,b);
    }
    map<PII , ll> mp;
    // cout<<"-----------------------"<<endl;

    VI y(10,0);
    REP(i,N){
        int a = x[i].first;
        int b = x[i].second;
        for(int k=a-2;k<=a;k++){
            for(int l=b-2;l<=b;l++){
                if(k<0 || l<0 || k>=(H-2) || l>=(W-2)){

                }else{
                    mp[make_pair(k,l)] +=1;
                    // cout<<k<<" "<<l<<endl;
                }
            }
        }
        // cout<<"--"<<i<<"--"<<endl;
    }

    vector<ll> ans(10,0);
    ans[0] = (H-2)*(W-2) ;
    for(auto s:mp){
        ans[s.second]++;
        ans[0]--;
    }
    
    REP(i,10){
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 57344
/* << IN THE NAME OF GOD >> */
#include <bits/stdc++.h>
using namespace std;



#define err(x) cerr << #x  << " = "<<  x << '\n'
#define out(x) cout << x << '\n'
#define forp(i, r, l) for(int i = int(r); i < int(l); i++)
#define forn(i, r, l) for(int i = int(r); i > int(l); i--)
#define FAST ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll ,ll> pll;
const int maxn = 1e5 + 120;
 

int main(){FAST;
   int n ,k;
   string str;
   cin >> n>> k;
    cin >> str;
   str[k - 1] =  tolower(str[k - 1]);
    cout << str;


   return 0;
}
 












Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define debug(x) std::cerr << #x << " = " << (x) << std::endl
typedef long long LL;
const int MAXN = 1e5+17;
vector<int > G[MAXN];
bool in[MAXN];
int main(int argc ,char const *argv[])
{
    #ifdef noob
    freopen("Input.txt","r",stdin);freopen("Output.txt","w",stdout);
    #endif
    int n,m;
    cin>>n>>m;
    int st=-1,ed=-1;
    for (int i = 0; i < m; ++i)
    {
    	int u,v;
    	cin>>u>>v;
    	G[u].push_back(v);
    	G[v].push_back(u);
    	if(st==ed)
    		st=u,ed=v;
    }
    deque<int > que;
    que.push_front(st);
    que.push_back(ed);
    in[st]=in[ed]=true;
    while(1)
    {
    	int hd = que.front();
    	bool hk=true,tk=true;
    	for(auto i : G[hd]) hk &= in[i];
    	for(auto i : G[hd])
    	{
    		if(hk) break;
    		if(!in[i])
    		{
    			in[i]=true;
    			que.push_front(i);
    			break;
    		}
    	}
    	int tl = que.back();
    	for(auto i : G[tl]) tk &= in[i];
    	for(auto i : G[tl])
    	{
    		if(tk) break;
    		if(!in[i])
    		{
    			in[i]=true;
    			que.push_back(i);
    			break;
    		}
    	}
    	if(hk&&tk) break;
    }
    cout<<que.size()<<endl;
    for(auto i:que)
    	cout<<i<<" ";
    cout<<endl;
    return 0;        
}

Measured memory_bytes: 6784
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
possibility = [[], [], []]

for i in range(M):
    for j in range(N):
        if sc[i][0]==j+1:
            possibility[j].append(sc[i][1])

ans = ''
if N > 1:
    for i in range(N):
        if i == 0:
            if (0 in list(set(possibility[i]))) or len(set(possibility[i])) > 1:
                ans = -1
                break
            elif len(possibility[i]) == 0:
                ans += str(1)
                continue
            else:
                ans += str(list(set(possibility[i]))[0])
        else:
            if len(possibility[i]) == 0:
                ans += str(0)
                continue
            elif len(set(possibility[i])) > 1:
                ans = -1
                break
            else:
                ans += str(list(set(possibility[i]))[0])
else:
    if len(set(possibility[0])) > 1:
        ans = -1
    elif len(possibility[0]) == 0:
        ans += str(0)
    else:
        ans += str(list(set(possibility[0]))[0])


print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc089() {
	ll n;
	ll ans = 0;

	cin >> n;

	multiset<string> s[5];
	string tmp;
	ll num;
	rep(i, n) {
		cin >> tmp;
		num = -1;
		if (tmp[0] == 'M') {
			num = 0;
		}
		else if (tmp[0] == 'A') {
			num = 1;
		}
		else if (tmp[0] == 'R') {
			num = 2;
		}
		else if (tmp[0] == 'C') {
			num = 3;
		}
		else if (tmp[0] == 'H') {
			num = 4;
		}

		if (num != -1) {
			if (s[num].find(tmp) == s[num].end()) {
				s[num].insert(tmp);
			}
		}
	}

	rep(i, 5) {
		if (s[i].size() > 0) {
			rep2(j, i + 1, 5) {
				if (s[j].size() > 0) {
					rep2(k, j + 1, 5) {
						if (s[k].size() > 0) {
							ans += s[i].size() * s[j].size() * s[k].size();
						}
					}
				}
			}
		}
	}

	cout << ans << "\n";
}

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

	solve_abc089();

	return 0;
}

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

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

  string s;
  ll k;
  cin >> s >> k;
  ll len = s.size();

  ll count = k;
  for (int i = 0; i < len; i++) {
    char c = s.at(i);
    int num = c - '0';

    if (count == 1) {
      cout << num << endl;
      break;
    }

    if (num == 1) {
      --count;
    } else {
      cout << num << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)
#define AAA (1000000007)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int RR, SS, PP;

int score(char x) {
	if (x == 'r')
		return RR;
	if (x == 's')
		return SS;
	if (x == 'p')
		return PP;

	cout << "error;";
	return 0;


}
int main() {
	int i, j, k;
	ll N, M, K;
	cin >> N >> K;
	int R, S, P;
	cin >> R >> S >> P;

	RR = P, SS = R, PP = S;
	vector<vector<char>> A(100000);
	string T;
	cin >> T;

	for (i = 0; i < N; i++) {
		char tmp = T[i];
		A[i% K].push_back(tmp);
	}
	ll ans = 0;
	for (i = 0; i < K; i++) {
		
		ans += score(A[i][0]);
		for (j = 1; j < A[i].size(); j++) {
			if (A[i][j - 1] != A[i][j])
				ans += score(A[i][j]);
			else
				A[i][j] = '0';


		}


	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  
  cin >> A >> B;
  
  int i = 0;
  int number =0;
  int a,b,c,d,e;
  for(i=0;A <= B;i++){
    a = A/10000;
    b = (A - 10000*a)/1000;
    c = (A - 10000*a-1000*b)/100;
    d = (A - 10000*a-1000*b - 100*c)/10;
    e = A - 10000*a-1000*b - 100*c - 10*b;
    
    if(a==e&&b==d)
      number++;
    
    A++;
  }
  
  cout << number << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

sunuke_set = set(range(1, N + 1))
for k in range(K):
    input()
    removed_sunuke_set = set(map(int, input().split()))
    for sunuke in removed_sunuke_set:
        if sunuke in sunuke_set:
            sunuke_set.remove(sunuke)
print(len(sunuke_set))

Measured memory_bytes: 9108
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String[] ss = s.split("");
		boolean check = false;
		for(int i =0;i<3;i++) {
			if(ss[i].equals("7"))check=true;
		}
		if(check) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}





}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


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

int main() {
    string s; cin >> s;
    int n = s.size();
    vector<long long> v(n+1);
    for (int i = 0; i < n; i++) {
        if (s[i] == '<') {
            v[i+1] = max(v[i+1], v[i]+1);
        }
    }
    for (int i = n-1; i >= 0; i--) {
        if (s[i] == '>') {
            v[i] = max(v[i], v[i+1]+1);
        }
    }
    long long ans = 0;
    for (int i = 0; i <= n; i++) {
        ans += v[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4740
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;
  ll arr[n + 5];
  ll val[n + 5];

  memset(val, 0, sizeof(val));
  for (ll i = 1; i <= n; i++)
    cin >> arr[i];

  ll res = 0;
  for (ll i = n; i >= 1; i--) {
    ll val1 = 0;
    for (ll j = 2 * i; j <= n; j += i)
      val1 += val[j];
    val1 &= 1;

    val[i] = (arr[i] - val1 + 2) % 2;
    res += val[i];
  }

  cout << res << en;
  for (ll i = 1; i <= n; i++) {
    if (val[i])
      cout << i << " ";
  }
  cout << en;
  return 0;
}

Measured memory_bytes: 3968
N, M = map(int, input().split())
A = list(map(int, input().split()))

s = sum(A)
A = sorted(A, reverse=True)
# Yesのためには、M個の商品全てが、s/(4M)以上の票を獲得することが必要
# つまり、M位の商品がs/(4M)以上の票を獲得していればYes、未満ならNo 
if A[M-1]*(4*M) >= s: print('Yes')
else: print('No')

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

using namespace std;
typedef long long ll;

ll n, m;

bool Dwu(vector< vector<int> >& G)
{
    vector<bool> odw(n, false);
    stack<int> S;
    vector<int> col(n, -1);
    odw[0] = true;
    S.push(0);
    col[0] = 0;
    while (!S.empty())
    {
        int akt = S.top();
        S.pop();
        for (int i = 0; i < G[akt].size(); ++i)
        {
            if (!odw[G[akt][i]])
            {
                odw[G[akt][i]] = true;
                S.push(G[akt][i]);
                if (col[akt] == 0)
                    col[G[akt][i]] = 1;
                else
                    col[G[akt][i]] = 0;
            }
        }
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < G[i].size(); ++j)
        {
            if (col[i] == col[G[i][j]])
                return false;
        }
    }
    return true;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m;
    vector< vector<int> > G(n);
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    if (!Dwu(G))
    {
        ll odp = (n * (n - 1) / 2) - m;
        cout << odp;
    }
    else
    {
        vector<bool> odw(n, false);
        stack<int> S;
        vector<int> odl(n, 0);
        odw[0] = true;
        S.push(0);
        odl[0] = 0;
        while  (!S.empty())
        {
            int akt = S.top();
            S.pop();
            for (int i = 0; i < G[akt].size(); ++i)
            {
                if (!odw[G[akt][i]])
                {
                    odw[G[akt][i]] = true;
                    S.push(G[akt][i]);
                    odl[G[akt][i]] = odl[akt] + 1;
                }
            }
        }
        ll pa = 0, ni = 0;
        for (int i = 0; i < n; ++i)
        {
            if (odl[i] % 2 == 0)
                ++pa;
            else
                ++ni;
        }
        ll zab = 0;
        for (int i = 0; i < pa; ++i)
            zab += pa - 1;
        for (int i = 0; i < ni; ++i)
            zab += ni - 1;
        zab /= 2;
        ll odp = (n * (n - 1) / 2) - m - zab;
        cout << odp;
    }
    return 0;
}


Measured memory_bytes: 6272
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;

void solve() {
  int n;
  cin >> n;
  int x = 7;
  if(__gcd(n, 10) != 1) {
    cout << -1 << endl;
    return;
  }
  int count = 1;
  while(true) {
    if(x%n == 0)
      break;
    x = ((x*10)%n + 7)%n;
    count++;
  }
  cout << count << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed << setprecision(10);
  int t = 1;
  // cin >> t;
  for(int tt = 1; tt <= t; tt++) {
    //cout << "Case #" << tt << ": ";
    solve();
  }
  return 0;
}  

Measured memory_bytes: 3600
<?php
function gcd($x, $y) {
    $r = $x % $y;
    if ($r == 0) {
        return $y;
    } else {
        return gcd($y, $r);
    }
}

$input = STDIN;

list($a, $b) = explode(' ', trim(fgets($input)));

print gcd($a, $b) . "\n";


Measured memory_bytes: 9228
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cerr << "\n\n" << "Time elapsed: " << \
					  (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
					  return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'



int main()
{
	fastio;
	#ifdef APNA_IO
		start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
    
    set<ll> s;
    ll a,b,c;
    cin>>a>>b>>c;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    if(s.size()==1)
    	cout<<"Yes";
    else
    	cout<<"No";

	#ifdef APNA_IO
		end_routine();
    #endif
}

Measured memory_bytes: 764
#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 rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    ll sur = 0, kt = 1;
    map<ll, ll> cnt;
    cnt[0]++;
    vector<ll> dp(len(s));
    rrep(i, len(s)) {
        ll v = s[i] - '0';
        sur = (sur + v * kt) % 2019;
        kt = (kt * 10) % 2019;
        cnt[sur]++;
        dp[i] = sur;
    }
    ll ans = 0;
    rep(i, len(s)) {
        cnt[dp[i]]--;
        ans += cnt[dp[i]];
        // printf("%lld\n", dp[i], cnt[dp[i]]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5132
#include<bits/stdc++.h>
#define maxn 10004
using namespace std;
typedef long long ll;
ll a[maxn];
int main(){
	ll  n,m;
	cin>>n>>m;
	ll sum =0;
	for(ll  i=0;i<m;i++){
		cin>>a[i];
		sum += a[i]; 
	}
	if(sum > n) cout<<"-1"<<endl;
	else{
		cout<<n-sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
char s[N];
int n,k;
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++)
		k=(k+s[i]-'0')%9;
	puts(k?"No":"Yes");
	return 0;
}

Measured memory_bytes: 3952
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld long double
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MAXN 100060
using namespace std;

int maxx=-INF,minx=INF;
int ans[MAXN];
int ca[MAXN],res,n;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		minx=min(minx,x-1);
		maxx=max(maxx,x+1);	
		ca[i]=x;
	}
	
	for(int i=0;i<n;i++)
	{
		for(int j=ca[i]-1;j<=ca[i]+1;j++)
			ans[j-minx]++;
	}
	
	for(int i=minx-minx;i<=maxx-minx;i++)
	{
		res=max(res,ans[i]);
	}
	
	printf("%d\n",res);
	
	
	return 0;	
} 

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

int main() {
	long long N, M, K;
	cin >> N >> M >> K;
	vector<long long> A(N), B(M);
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < M; i++) cin >> B[i];
	vector<long long> SA(N + 1), SB(M + 1);
	SA[0] = 0, SB[0] = 0;
	for (int i = 0; i < N; i++) SA[i + 1] = SA[i] + A[i];
	for (int i = 0; i < M; i++) SB[i + 1] = SB[i] + B[i];
	int ANS = 0;
	for (int i = 0; i <= N; i++) {
		if (SA[i] > K) break;
		ANS = max(ANS, i + (int)M - (int)(SB.end() - upper_bound(SB.begin(), SB.end(), K - SA[i])));
	}
	cout << ANS << endl;
}

Measured memory_bytes: 9596
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222






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


  ll r, d, x;
  cin >> r >> d >> x;
  rep(i, 10) {
    ans = r * x - d;
    cout << ans << endl;
    x = ans;
  }





  return 0;
}

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

int main(){
    long double N,K; cin>>N>>K;
    vector<long double>v(K);
    long double x=2;
    long double cnt=1;
    for(int i=K-1;i>0;i--){
        if(i*x>=K)v[i]=cnt;
        else{
            cnt++;
            v[i]=cnt;
            x*=2;
        }
    }
    long double ans=0.0;
    if(N<K){
        for(int i=1;i<=N;i++){
            ans+=pow(0.5,v[i]);
        }
        ans/=N;
    }else{
        for(int i=1;i<K;i++){
            ans+=pow(0.5,v[i]);
        }
        ans+=N-K+1;
        ans/=N;
    }
    cout<<setprecision(12)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792