akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
#define int long long
signed main()
{
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    double tansin = 30*h+0.5*m;
    double chousin = m*6;
    double kakudo = min(abs(tansin - chousin),360-abs(tansin - chousin))   ;
    double ans = a*a + b*b -2*a*b*cos(kakudo*acos(-1)/180);
    printf("%12.12lf",sqrt(ans));
    return 0;
}

Measured memory_bytes: 4224
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n;
  rd(n);
  auto a = new int[](n);
  foreach (i; 0 .. n)
    rd(a[i]);

  bool[int] map;
  foreach (e; a) {
    if (e in map)
      map.remove(e);
    else
      map[e] = true;
  }
  writeln(map.length);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 6652
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n 
#define pl(n) cout<<n<<" "
const int Nx=2e5+2;
const int inf=(int)(1e19+10LL);
void solve()
{
 int h1,s1,h2,s2;
 sl(h1);sl(s1);sl(h2);sl(s2);
 while(true){
 	h2=h2-s1;
 	if(h2<=0){
 		cout<<"Yes"<<endl;
 		return;
 	}
 //	cout<<h2<<" ";
 	h1=h1-s2;
 	if(h1<=0){
 		cout<<"No"<<endl;
 		return;
 	}
 //	cout<<h1<<" ";
 	
 }
 
  
}

signed main(){
  int test=1;
// sl(test);
 while(test--){
 	solve();
 }
 
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n)-1;i>=(j);i--)
using ll=long long;
using namespace std;
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; }
const ll INF=1LL<<60;

ll n,a,b,maxv,minv;

int main(){
    cin>>n>>a>>b;
    if(a>b) cout<<0<<"\n";
    else if(n==1 && a!=b) cout<<0<<"\n";
    else{
        minv=a*(n-1)+b;
        maxv=b*(n-1)+a;
        cout<<maxv-minv+1<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
using namespace std;
int main(){   
   int h,a;
   cin>>h>>a;
   cout<<(((h%a)==0)? (h/a):(h/a+1));
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b,c,d;
    string s;
    cin>>n>>a>>b>>c>>d>>s;
    bool f1=false,f2=false;
    rep2(i,a-1,max(c,d)){
        if(s[i]=='#' && s[i+1]=='#') f1=true;
    }
    rep2(i,b-1,min(c,d)){
        if(s[i]=='.' && s[i+1]=='.' && s[i-1]=='.') f2=true;
    }
    if(c<d){
        if(f1) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    else{
        if(!f1 && f2) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 592
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)                  cerr<<#x<<": "<<x<<endl
#define trace2(x, y)              cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)              cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)          cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)     cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,w;
    cin >> n >> w;
    std::vector<ll> weight(n+1),value(n+1);
    rep(i,1,n+1) cin >> weight[i] >> value[i];
    std::vector<ll> dp(w+1,0);
    for(ll i=1; i<=n; i++){
        for(ll j=w; j>=weight[i]; j--){
            dp[j]=max(dp[j],dp[j-weight[i]]+value[i]);
        }
    }
    cout << dp[w];
    return 0;
}

Measured memory_bytes: 1024
from collections import defaultdict
d = defaultdict(list)
N = int(input())
s = []
for i in range(N):
    c = int(input())
    for _ in range(c):
        a,b = map(int, input().split())
        d[i].append((a-1,b))
ans = 0

# print(d)
for i in range(2**N):
    bins = format(i,"016b")[::-1]
    # 各bitに対して確認作業
    cnt = 0
    for i,b in enumerate(bins):
        if b == "1": #i番目の人が正直者のとき
            cnt += 1
            # 言った内容を聞く
            ls = d[i]
            flg = True
            for a,b in ls:
                # 言った内容と、事実が合っていない
                if int(b) != int(bins[a]):
                    flg = False
                    break
            if not flg:
                cnt = 0
                break
        
    ans = max(ans,cnt)
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  string str;
  if(A>=9 || B>=9){
    str = ":(";
  }
  else{
    str = "Yay!";
  }
  cout << str << endl;
}
    

  
      
      
      


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
#include <string.h>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LL MOD = 1000000007;
const int INF = 1000000007;
const LL LINF = 1LL * INF * INF;
const int MAXN = 100007;
const LD EPS = 1e-7;

int A[MAXN];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n, m = INF, M = 0, n1 = 0;
	cin >> n;
	REP(i, n)
	{
		cin >> A[i];
		m = min(m, A[i]);
		M = max(M, A[i]);
	}
	if (M - m > 1)
	{
		cout << "No";
		return 0;
	}
	if (M == m && M == n - 1)
	{
		cout << "Yes";
		return 0;
	}
	REP(i, n)
		n1 += A[i] == M - 1;
	cout << (n1 < M && 2 * M <= n + n1 ? "Yes" : "No");
	//cout << endl; system("pause");
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, X, A[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> X;
    rep(i, 0, N) cin >> A[i];
    sort(A, A + N);

    int ans = 0;
    rep(i, 0, N) {
        if (X < A[i]) break;
        X -= A[i];
        ans++;
    }
    if (0 < X and ans == N) ans--;
    cout << ans << endl;
}

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

int main(int argc, char* argv[]) {
	int n, m;
	cin >> n >> m;
	int A[n][m];
	int B[m][1];
	int C = 0;

	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			cin >> A[i][j];

	for(int i = 0; i < m; i++)
		cin >> B[i][0];

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			C += A[i][j] * B[j][0];
		}
		printf("%d\n",C);
		C = 0;
	}


	return 0;

}

Measured memory_bytes: 1184
#include<stdio.h>
#include<string.h>
int main(void){
    int n,ans=0;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",s);
    for(int i=0;n-2>i;++i){
        if((strncmp("A",&s[i],1)==0)&&(strncmp("B",&s[i+1],1)==0)&&(strncmp("C",&s[i+2],1)==0))
        ++ans;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a)  a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

using namespace std;

int N, M;
int a[100005];
int dp2[100005][35];

void Pre(){
    for(int n=0;n<N;++n){
        dp2[n][0] = a[n];
    }
    for(int j=1;j<=20;++j){
        for(int i=0;i<=(N - (1<<j));++i){
            dp2[i][j] = max(dp2[i][j - 1], dp2[i + (1 << (j - 1))][j - 1]);
        }
    }
}

int Find1(int l, int r){
    int Ans = 0;
    for(int j=20;j>=0;--j){
        if(l + (1 << j) - 1 <= r){
            Ans = max(Ans, dp2[l][j]);
            l += (1 << j);
        }
    }
    return Ans;
}

int main(){
   cin >> N >> M;
   for(int n = 0; n < N; ++n){
      scanf("%d", &a[n]);
   }
   Pre();
   vector<long long> p;
   for(int n = 0; n < N; ++n){
      p.pb((long long)abs(a[n] - 0ll - (long long)Find1(n, (int)N - 1)));
   }
   sort(allr(p));
   long long q = p[0];
   int res = 0;
   for(int i = 0; i < p.sz; ++i){
      if(q > 0 && p[i] == q){
         ++res;
      }
      M -= 2;
   }
   cout << res << endl;
   return 0;
}

Measured memory_bytes: 15480
#include <stdio.h>

int main(void){
  
  int x,y;

  while(1){
    scanf ("%d %d",&x,&y);

    if (x==y&&y==0){
      break;
    } else if (x<y){
      printf ("%d %d\n",x,y);
    } else if (y<x){
      printf ("%d %d\n",y,x);
    } else if (x==y){
      printf ("%d %d\n",x,y);
  }
  }
    return 0;
  }

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if((b/a)<=c) cout << b/a << endl;
    else cout << c << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
 
inline int read()
{
	int sum=0,ff=1; char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') ff=-1;
		ch=getchar();
	}
	while(isdigit(ch))
		sum=sum*10+(ch^48),ch=getchar();
	return sum*ff;
}
 
int n,m,ans=1e18,a[10005];
 
signed main()
{
	n=read();
	for ( int i=1;i<=n;i++ ) a[i]=read();
	for ( int i=1;i<=100;i++ ) 
	{
		int sum=0;
		for ( int j=1;j<=n;j++ ) 
			sum+=(a[j]-i)*(a[j]-i);
		ans=min(ans,sum);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF MOD
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    bool x;
    cin >> x;
    x^= true;
    cout << x << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	double N,X;
	cin>>N>>X;
	double ans=N/X;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
d = {}

for i in range(H):
    li = list(input())
    for j in li:
        if j not in d:
            d[j] = 1
        else:
            d[j] += 1

norm = (H//2) * (W//2)

unit = 0
for i in d:
    unit += d[i] // 4

if unit < norm:
    print("No")
    exit()
else:
    for i in d:
        if norm == 0:
            continue
        if d[i] >= 4:
            num = min(norm, d[i] // 4)
            d[i] -= 4 * num
            norm -= num

if (H % 2 == 0) ^ (W % 2 == 0):
    for i in d:
        if d[i] % 2 == 1:
            print("No")
            exit()
    print("Yes")
    exit()
else:
    odd = 0
    for i in d:
        if d[i] % 2 == 1:
            odd += 1
            if odd >= 2:
                print("No")
                exit()
    print("Yes")

Measured memory_bytes: 3064
x = int(input())

a = 1
while True:
    b = 0
    a5 = a ** 5
    b5 = b ** 5
    while a5 - b5 > x:
        b += 1
        b5 = b ** 5
    if a5-b5 == x:
        print(a, b)
        exit()

    b = 0
    b5 = b ** 5
    while a5 - b5 < x:
        b -= 1
        b5 = b ** 5
    if a5-b5 == x:
        print(a, b)
        exit()

    a += 1


Measured memory_bytes: 64292
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// rep(i, 1, 5) --> {1,2,3,4}
// rep(i, 5, 1) --> {4,3,2,1}
// rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n;
    cin >> n;
    map<ll, int> mp;
    while(n--)
    {
        ll a;
        cin >> a;
        mp[a]++;
    }
    int sum = 0;
    for (auto x:mp)
    {
        if (x.second%2!=0)
            sum++;
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int Long;
Long maxi=0;
Long mini=1<<30;
int main()
{
	int N;
	
	cin>>N;
	Long A[N];
	for(int i=0;i<N;i++){
		cin>>A[i];
		mini= min(mini,A[i]);
		maxi= max(maxi, A[i]);
	}
	cout<<maxi-mini<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int Q=1<<19;
int sm[2],a[Q],b[Q];
int n;
int ch(int lim)
{
	int op=0;
	for(int i=1;i<=n;i+=2)
		if(b[i]-op>=lim)op=min(op,b[i+1]);
	return b[n]-op>=lim;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]),b[i]=b[i-1]+(i&1?1:-1)*a[i],sm[i&1]+=a[i];
	if(n&1){
		int l=0,r=sm[0]+sm[1];
		while(l<=r){
			int mid=(l+r)>>1;
			if(ch(mid))l=mid+1;
			else r=mid-1;
		}
		return printf("%d %d",sm[0]+r,sm[1]-r)&0;
	}
	if(sm[0]<sm[1])swap(sm[0],sm[1]);
	printf("%d %d",sm[0],sm[1]);
	return 0;
}

Measured memory_bytes: 3456
from functools import reduce
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def gcd_list(nums):
    return reduce(gcd, nums)

n = input()
A = list(map(int, input().split()))

gcd_num = gcd_list(A)
ope = 0
while 1:
    if gcd_num % 2 == 0:
        ope += 1
        gcd_num /= 2
    else:
        break
print(ope)

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

int main() {
  int N;
  cin >> N;
  int a=0,i=8;
  while(i>=0){
    int c=1;
    for(int j=0;j<i;j++){
      c*=10;
    }
    int d=(N/c)%10;
    a+=d;
    i--;
  }
  if(N%a==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long cc;
static const cc MAX = 2000;
cc i, j, N;
double M, k, sub = 0, n = 0, A[MAX], B[MAX];
double judge = 0, Ans = 0;
string S;
char vec[10];
char T;
/*
vector<cc> vec1(MAX), vec2(MAX);
vector<pair<cc, cc>> pairs(MAX);
*/



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

	sort(A, A + N);
	
	Ans = (A[0] + A[1]) / 2;
	for (i = 2; i < N; i++)
		Ans = (Ans + A[i]) / 2;

	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
A = list(map(int, input().split()))
num = 0
for i in range(N-1):
  if x < A[i] + A[i+1]:
    d = A[i] + A[i+1] - x
    num += d
    if d > A[i+1]:
      A[i] -= d - A[i+1]
      A[i+1] = 0
    else:
      A[i+1] -= d
print(num)

Measured memory_bytes: 14252
S = input()
if S[0:7] == "keyence":
    print("YES")
elif S[len(S)-7:len(S)] == "keyence":
    print("YES")
else:
    if (S[0:1] == "k")and(S[len(S)-6:len(S)] == "eyence"):
        print("YES")
    elif (S[0:2] == "ke")and(S[len(S)-5:len(S)] == "yence"):
        print("YES")
    elif (S[0:3] == "key")and(S[len(S)-4:len(S)] == "ence"):
        print("YES")
    elif (S[0:4] == "keye")and(S[len(S)-3:len(S)] == "nce"):
        print("YES")
    elif (S[0:5] == "keyen")and(S[len(S)-2:len(S)] == "ce"):
        print("YES")
    elif (S[0:6] == "keyenc")and(S[len(S)-1:len(S)] == "e"):
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
    long long int a,b;
    long double c;

    scanf("%lld %lld",&a,&b);

    c=(a+b)/2.0;
    a=(a+b)/2;

    if(c-a==0.00) printf("%.0Lf\n",c);
    else printf("IMPOSSIBLE\n");

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
int main()
{
  ll n,x,t;
  cin>>n>>x>>t;
  ll p=n/x;
  if(n%x!=0)
    p++;
  cout<<(p*t)<<endl;
  return 0;
}

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

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

  map<char, int> m;

  for(int i = 0; i < w.size(); i++) {
    m[w[i]] += 1;
  }


  for(int i = 0; i < w.size(); i++) {
    if(m[w[i]] % 2 != 0) { cout << "No"; return 0; }
  }

  cout << "Yes";

  return 0;
 


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
   
  #define ll long long
  #define pb push_back
  #define mp make_pair
  #define ff first
  #define ss second


   
void func(){

double l;
cin>>l;
l=l/3;
l=l*l*l;
cout<<setprecision(10)<<l<<endl;
}
   
   
  int main(){
          ios_base::sync_with_stdio(false);
          cin.tie(0);
          cout.tie(0);
   
        /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r" , stdin);
        freopen("output.txt", "w" , stdout);
        #endif*/
   
     ll t=1;
     //cin>>t;
     while(t--)
     func();
   }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){

  int N,i,j,k,t;
  int A[3][3];
  int B[10];
  bool can;
  can=false;
  //  string S,A;
  
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
    cin>>A[i][j];
    }
  }
  cin>>N;
  for(i=0;i<N;i++){
    cin>>B[i];
  }

    for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      // cout<<A[i][j]<<endl;
    }
  }
 
  for(i=0;i<3;i++){
    t=0;
    for(j=0;j<3;j++){
      for(k=0;k<N;k++){
	if(A[i][j]==B[k]){
	  t+=1;
	  if(t==3)can=true;
	  break;
	}
      }
    }
}
  
  for(i=0;i<3;i++){
    t=0;
    for(j=0;j<3;j++){
      for(k=0;k<N;k++){
	if(A[j][i]==B[k]){
	  t+=1;
	  if(t==3)can=true;
	  break;
	}
      }
    }
}

  t=0;
  for(i=0;i<3;i++){
      for(k=0;k<N;k++){
	if(A[i][2-i]==B[k]){
   t+=1;
   if(t==3)can=true;
      break;
	}
	if(t==3)can=true;
      }
   
}
  t=0;
for(i=0;i<3;i++){
  for(k=0;k<N;k++){
    if(A[i][i]==B[k]){
      t+=1;
      if(t==3)can=true;
      break;
    }
      }
    }

  if(can) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a = bisect.bisect_right(l, l[j]-l[i])
        b = bisect.bisect_left(l, l[i]+l[j])
        a = max(j+1, a)
        b = max(j+1, b)
        ans += b - a

print(ans)

Measured memory_bytes: 46552
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  if (((s[0] == s[1])&&(s[1]==s[2]))||((s[1] == s[2])&&(s[3]==s[2]))) {
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main() {
  int s;
  cin >> s;
  
  bool YYMM = true;
  bool MMYY = true;
  
  if(s % 100 > 12 || s % 100 == 0) YYMM = false;
  if(s / 100 > 12 || s / 100 == 0) MMYY = false;
  
  if(YYMM){
    if(MMYY) cout << "AMBIGUOUS" << endl;
    else cout << "YYMM" << endl;
  }
  else{
    if(MMYY) cout << "MMYY" << endl;
    else cout << "NA" << endl;
  }
}

Measured memory_bytes: 384
#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  int a = n%10;
  
  if(a == 3){
    printf("bon\n");
  }
  else if(a == 0 || a == 1 || a == 6 || a == 8){
    printf("pon\n");
  }

  else{
    printf("hon\n");
  }
  
  return 0;
}


Measured memory_bytes: 1660
#include <iostream>

class baseball{
	private : 
	bool firstRunner; //first runnner flag
	bool secondRunner; //second runnner flag
	bool thirdRunner; //third runnner flag

	int score; //inning score
	int outCount; //number of out count 

	public :  
	baseball();

	void doHit();
	void doHomerun();
	void doOut();

	int getOutCount();
	void showScore();
};

baseball::baseball(){
	firstRunner = false; 
	secondRunner = false;
	thirdRunner = false;

	score = 0;
	outCount = 0; 
}

void baseball::doHit() {
	//advance to the next base
	if(thirdRunner == true){
		++score;
		thirdRunner = false;
	}
	if(secondRunner == true){
		thirdRunner = true;
		secondRunner = false;
	}
	if(firstRunner == true){
		secondRunner = true;
	}
	firstRunner = true;
}

void baseball::doHomerun(){
	//advance to the next base
	if(thirdRunner == true){
		++score;
		thirdRunner = false;
	}
	if(secondRunner == true){
		++score;
		secondRunner = false;
	}
	if(firstRunner == true){
		++score;
		firstRunner = false;
	}
	++score;
}

void baseball::doOut(){
	//add out count
	++outCount;
}

int baseball::getOutCount(){
	return outCount;
}

void baseball::showScore(){
	std::cout << score << std::endl;
}


int main(void){
	u_int n = 0; //number of data set
	std::cin >> n; //input number of data set

	baseball game[n]; //make n baseball class

	for(size_t i = 0; i < n; ++i){
		while(game[i].getOutCount() < 3){
			std::string str;
			std::cin >> str; //input event

			if(str == "HIT"){ //judge event
				game[i].doHit();
			}else if(str == "HOMERUN"){
				game[i].doHomerun();
			}else if(str == "OUT"){
				game[i].doOut();
			}else{
				std::cout << "error : wrong strings" << std::endl;
			}
		}
		game[i].showScore(); //output inning score
	}

	return 0;
}

Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main(){
	string str;
	cin >> str;
	int cnt = 0;
	int length =0;

	for(int i=0;i<str.length()/2;i++){
		if(str[i]!=str[str.length()-1-i])
			cnt++;
	}

	cout << cnt;
}

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

namespace CSharpSample01
{
    

    class Program
    {       

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int[] data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            long sunuke = 0;
            long arai = 0;
            long min = long.MaxValue;

            for(int i = 0; i < N; i++)
            {
                arai += data[i];
            }

            for(int i = 0; i < N - 1; i++)
            {
                sunuke += data[i];
                arai -= data[i];

                //Console.WriteLine($"sunuke = {sunuke} arai = {arai}");

                if(min > Math.Abs(sunuke - arai))
                {
                    min = Math.Abs(sunuke - arai);
                }

            }

            Console.WriteLine(min);

        }
    }
}


Measured memory_bytes: 33628
import collections
import numpy as np

N = int(input())
A = list(map(int, input().split()))

cnt = collections.Counter(A)

B = [cnt[a] for a in A]

def cmb(n):
    return n * (n - 1) // 2
    
ans = int(sum([cmb(k) for k in cnt.values()]))

for b in B:
    print(ans - cmb(b) + cmb(b - 1))

Measured memory_bytes: 34152
N = int(input())
As = list(map(int, input().split()))

sA = sum(As) % (10 ** 9 + 7)
print((sA * sA - sum( (A * A % (10 ** 9 + 7) for A in As) ) ) * pow(2, -1, 10 ** 9 + 7) % (10 ** 9 + 7))


Measured memory_bytes: 31432
#include <stdio.h>

#include <string.h>

#include <iostream>

#include <algorithm>

#include <math.h>

#include <limits.h>

#include <map>

#include <stack>

#include <queue>

#include <vector>

#include <set>

#include <string>

#define ll long long

#define ull unsigned long long

#define ms(a) memset(a,0,sizeof(a))

#define pi acos(-1.0)

#define INF 0x7f7f7f7f

#define lson o<<1

#define rson o<<1|1

const double E=exp(1);

const int maxn=1e6+10;

const int mod=1e9+7;

using namespace std;

int a[maxn];

int vis[maxn];

bool check(int n)

{

	while(n)

	{

		if(vis[n%10])

			return false;

		n/=10;

	}

	return true;

}

int main(int argc, char const *argv[])

{

	ios::sync_with_stdio(false);

	int n,k;

	int x;

	cin>>n>>k;

	for(int i=0;i<k;i++)

	{

		cin>>x;

		vis[x]=1;

	}

	for(int i=n;;i++)

	{

		if(check(i))

		{

			cout<<i<<endl;

			return 0;

		}

	}

	return 0;

}

Measured memory_bytes: 256
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>


#define DEBUG if(false)

using namespace std;

using ll = long long;
#define LINE printf("LINE : %d\n", __LINE__);
#define loop(i, n) for(i = 0; i < n; i++)
template<class T> using vec = vector<T>;
const int MOD = 998244353;

int main(){
  int A, B, V, W, T;
  cin >> A >> V; // 鬼
  cin >> B >> W; //子供
  cin >> T;
  bool boolean = true;
  if(V <= W){
    boolean = false;
  }else{
    // 鬼のほうが速い
    if((V-W)*(ll)T < (ll)abs(A-B)){
      boolean = false;
    }
  }
  if(boolean){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int n,i,j,c,sum,mn=INT_MIN,mx=INT_MAX;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++){
         cin>>a[i];
         if(a[i]>mn) mn=a[i];
    }
    for(i=1;i<=mn;i++)
    {
        sum=0;
        for(j=0;j<n;j++)
        {
            sum+=(i-a[j])*(i-a[j]);
        }
        if(sum<mx) mx=sum;
    }
    cout<<mx<<endl;

    return 0;
}


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

int main(){
  int n,a[1000],mina;
  while(1){
    cin>>n;
    if(n==0)
      break;
    for(int i=0;i<n;i++)
      cin>>a[i];
    sort(a,a+n);
    mina=1000000;
    for(int i=0;i<n-1;i++)
      if(a[i+1]-a[i]<mina)
        mina=a[i+1]-a[i];
    cout<<mina<<endl;
  }
}


Measured memory_bytes: 3116
/*
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC
CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

#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()

using namespace std;
typedef long long int ll;

int main(){
    ll x;
    cin >> x;
    cout << "ABC" << x << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define dunk(a) cout << (a) << endl
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;

int main() {
	int n; cin >> n;
	string s; cin >> s;
	bool res = true;
	bool e = true;
	if (n % 2 == 1) {
		e = false;
		res = false;
	}

	if (e) {
		rep(i, n / 2) {
			if (s[i] != s[n / 2 + i]) res = false;
		}
	}

	if (res) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x,min,counter;counter=0;
    cin>>n>>x;
    int m[n];
    for(int k=1;k<=n;k++)
    {
        cin>>m[k];
    }
    min=m[1];
    for(int a=2;a<=n;a++)
    {
        if(min>m[a])
        min=m[a];
    }

    for(int w=1;w<=n;w++)
    {
        x=x-m[w];
    }
    while(1)
    {
        x=x-min;
        if(x<0)
        break;
        counter++;
    }
    cout<<n+counter<<endl;
    return 0;
}

Measured memory_bytes: 256
N, K, Q = map(int,input().split())
scores = [0] * N

for i in range(Q):
    ans_i = int(input())
    scores[ans_i-1] += 1    

for i in range(N):
    final_res = K - (Q - scores[i])  
    if final_res <= 0:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 50904
N,T = list(map(int,input().split()))
C = [list(map(int, input().split())) for i in range(N)]
ans = 10000
C = sorted(C,key=lambda x:x[0])
for i in range(N):
  if C[i][1] <= T:
    ans = C[i][0]
    break
if ans == 10000:
  print("TLE")
else:
  print(ans)

Measured memory_bytes: 3060
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

int main(){
    long long N, M;
    cin >> N >> M;
    dsu d(N);
    for(int i = 1; i <= M; i++){
        long long A, B;
        cin >> A >> B;
        A--;
        B--;
        d.merge(A, B);
    }
    vector<vector<int>> G = d.groups();
    long long ans = G.size() - 1;
    cout << ans << endl;
}

Measured memory_bytes: 8904
#include "bits/stdc++.h"
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << endl
const int maxn=1e3+5;
long long  dp[maxn][maxn];
#define MOD 1000000007
int h,w;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>h>>w;
  vector<string>v;
  string s;
  for(int i=0;i<h;i++){
    cin>>s;
    v.push_back(s);
  }
  dp[0][0]=1;
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
        if(v[i][j]=='.'){
          if(i>0){
            dp[i][j]=(dp[i][j]+dp[i-1][j]%MOD)%MOD;
          }
          if(j>0){
            dp[i][j]=(dp[i][j]+dp[i][j-1]%MOD)%MOD;
          }
        }

    }
  }
  cout<<dp[h-1][w-1]<<endl;


       
  return 0;
}


Measured memory_bytes: 9216
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input()[:-1]  # 改行をなくす
n = len(S) - 1  # +を入れる事ができる場所の数

# bit全探索
P = []
for bit in range(0, 1<<n):  # 00 ~ 11
    plus = [""] * n
    for j in range(n):
        if bit>>j & 1:
            plus[j] = "+"
    P.append(plus)



ans = 0
if n == 0:
    print(int(S))
else:
    for plus in P:
        nums = []
        tmp = S
        pre = 0
        for i in range(n):
            if plus[i] == "+":
                nums.append(int(tmp[pre:i+1]))
                pre = i+1
            if i == n-1:
                nums.append(int(tmp[pre:]))
        ans += sum(nums)
    print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  int a[n][m];
  int c[n];
  rep(i,n+1){
    cin >> c[i];
    rep(j,m){
      cin >> a[i][j];
    }
  }
  int ans=1e9;
  for(int bit=0;bit<(1<<n);bit++){
    int mini=0;
    vector<int> is(m);
    rep(i,n){
      if(bit>>i&1){
        mini+=c[i];
        for(int j=0;j<m;j++){
          is.at(j)+=a[i][j];
        }
      }
    }
    bool pq=true;
    for(int j=0;j<m;j++){
      if(is.at(j)<x){
        pq=false;
      }
    }
    if(pq){
      ans=min(ans,mini);
    }
  }
  if(ans==1e9){
    ans=-1;
  }
  cout <<ans;
}


Measured memory_bytes: 3616
#include <stdio.h>

int main(void) {

  int n;
  scanf("%d", &n);
  int generate[n];
  for (int i = 0; i < n; i++) {
    generate[i] = 0;
  }
  int max[n];
  while (1) {
    for (int i = 0; i < n; i++) {
      max[0] = 0;
      if (i != 0 && generate[i] > max[i-1]) {
        max[i] = generate[i];
      } else {
        max[i] = max[i-1];
      }
      printf("%c", 'a'+generate[i]);
    }
    printf("\n");
    if (generate[n-1] == n-1) {
      break;
    }
    for (int i = n-1; i >= 1; i--) {
      if (generate[i] > max[i-1]) {
        generate[i] = 0;
      } else {
        generate[i]++;
        break;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 1408
import java.util.*;

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

        String O = sc.next();
        String E = sc.next();
        String S = "";

        for(int i=0; i<O.length(); i++){
            if(i!=O.length()-1){
                S += String.valueOf((char)O.charAt(i)) + String.valueOf((char)E.charAt(i));
            }
            else{
                if(O.length()==E.length()){
                    S += String.valueOf((char)O.charAt(i)) + String.valueOf((char)E.charAt(i));
                }
                else{
                    S += String.valueOf((char)O.charAt(i));
                }
            }
        }
        System.out.println(S);
    }
}

Measured memory_bytes: 23508
#include <stdio.h>


int main()
{
    int n,m,s=0;
    scanf("%d",&n);
    m=n;
    while(n!=0){
        s+=n%10;
        n/=10;
    }
    
    if(m%s==0)printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 128
S = input()
list = ['A', 'C', 'G', 'T']
answer = 0
current = 0
for i in range(len(S)):
    if S[i] not in list:
        if answer < current:
            answer = current
        current = 0
    elif S[i] in list:
        current += 1
if answer < current:
    answer = current
print(answer)


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

using namespace std;

int main() {
    int n;
    cin >> n;
    int a[205];
    for(int i = 0; i < n; i++) cin >> a[i];

    int ans = 1000000000;
    for (int i = 0; i < n; i++) {
        int tmp = 0;
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            tmp++;
        }
        if (ans > tmp) ans = tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//解説あり
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;
static const int MAX = 1000005;

ll ans;
int N;
int A[10005];

vector<int> prime; //素因数の列挙
vector<pair<int, int> > v[10005], lcm; //v:A[i]の素因数とその数, lcm:最小公倍数の素因数分解されたもの
int lcm_cnt[MAX];

void eratos() {
	bool t[MAX];
	vector<int> v;

	for (int i = 2; i*i <= MAX; i++) t[i] = true;

    for (int i = 2; i*i <= MAX; i++) {
    	if ( t[i] == true ) {
    		prime.push_back(i);
    		for (int j = i + i; j <= MAX; j += i) t[j] = false;
    	}
    }
    return;
}

void prime_factrization(int p) {
    int n = A[p];
	for (int i = 0; i < prime.size() && A[p] >= prime[i]; i++) {	
		if (n % prime[i] == 0) {
            int c = 0;
			while (n % prime[i] == 0) {
				c++;
				n /= prime[i];
			}
            v[p].pb(mp(prime[i], c));
		}
	}	
	if (n > 1) v[p].pb(mp(n, 1));
	return;
}

int main(void) {
    scanf("%d", &N);
    rep(i, 0, N)scanf("%d", &A[i]);

    eratos();

    //A[i]の素因数分解
    rep(i, 0, N) {
        prime_factrization(i);
    }
    //lcm_cntに最小公倍数の素因数分解されたものの個数を保持する
    //lcmに最小公倍数のうち、素数の数が0より大きいものについて、素数と個数の組み合わせを保持する
    rep(i, 0, N) {
        for (int j = 0; j < (int)v[i].size(); j++) {
            lcm_cnt[v[i][j].first] = max(lcm_cnt[v[i][j].first], v[i][j].second);
        } 
    }
    rep(i, 0, MAX) if (lcm_cnt[i] > 0) lcm.pb(mp(i, lcm_cnt[i]));


    rep(i, 0, N) {
        ll t = 1;
        int j = 0;
        for (int k = 0; k < (int)lcm.size(); k++) {
            int cnt = 0;
            if (j < (int)v[i].size() && lcm[k].first == v[i][j].first) {
                cnt = lcm[k].second - v[i][j].second;
                j++;
            } else {
                cnt = lcm[k].second;
            }
            while (cnt-- > 0) {
                t *= (ll)lcm[k].first;
                t %= MOD;
            }
        }

        ans += t % MOD;
        ans %= MOD;
  
    }


   

  
    printf("%lld\n", ans % MOD);

	return 0;
}


Measured memory_bytes: 5504
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

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

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  string s; cin >> s;
  vector<int> vec(26, 1);
  for(auto c: s) {
    vec[c - 'a']++;
  }
  ll ans = 1;
  rep(i, 26) {
    ans *= vec[i];
    ans %= mod;
  }

  cout << (ans+mod-1)%mod << endl;

}


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

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

    bool is_easy = true;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0) {
            if (s[i] == 'L') {
                is_easy = false;
                break;
            }
        }
        else {
            if (s[i] == 'R') {
                is_easy = false;
                break;
            }
        }
    }

    if (is_easy == true) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}


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

int n;
double p[3000], dp[3001][3001];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    for (int i=0; i<=3000; i++)
        for (int j=0; j<=3000; j++)
            dp[i][j] = 0;

    cin>>n;
    for (int i=0; i<n; i++)
        cin>>p[i];
    
    for (int idx=0; idx<n; idx++) {
        for (int heads=0; heads<=n; heads++) {
            if (idx==0) {
                if (heads==0) dp[idx][heads] = 1-p[idx];
                else if (heads==1) dp[idx][heads] = p[idx];
            }
            else {
                dp[idx][heads] += dp[idx-1][heads] * (1-p[idx]);
                if (heads > 0)
                    dp[idx][heads] += dp[idx-1][heads-1] * p[idx];
            }
        }
    }

    double ans=0;
    for (int heads=n/2+1; heads<=n; heads++)
        ans += dp[n-1][heads];
    
    cout << fixed << setprecision(10);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 70656
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

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

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s1 = in.nextString();
            String s2 = in.nextString();

            List<Boolean> piledList = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                if (s1.charAt(i) == s2.charAt(i)) {
                    piledList.add(false);
                } else {
                    piledList.add(true);
                    i++;
                }
            }

            long ans;
            if (piledList.get(0)) {
                ans = 6;
            } else {
                ans = 3;
            }

            long MOD = 1_000_000_007;
            Modulo modulo = new Modulo(MOD);
            for (int i = 1; i < piledList.size(); i++) {
                if (piledList.get(i - 1)) {
                    if (piledList.get(i)) {
                        ans = modulo.mlt(ans, 3);
                    }
                } else {
                    ans = modulo.mlt(ans, 2);
                }
            }

            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

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

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }

    static class Modulo {
        long m;

        public Modulo(long m) {
            this.m = m;
        }

        public long mlt(long a, long b) {
            return (a * b) % m;
        }

    }
}



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

int main()
{
    int t, x;
    cin >> t >> x;
    double ans = (double)t / x;
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 3764
import java.util.Scanner;

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

        sc.close();

        x -= z;

        System.out.println(x / (y + z));

    }

}


Measured memory_bytes: 21844
def gcd(a, b):
	if a < b:
		tmp = a
		a = b
		b = tmp
	
	r = a % b
	while r != 0:
		a = b
		b = r
		r = a % b

	return b

if __name__ == '__main__':
	l = list(map(int, input().split()))
	x = l[0]
	y = l[1]

	ans = gcd(x, y)
	print(ans)

Measured memory_bytes: 5600