akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))


//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g,c;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[600010];//適宜変える(ecnt)
//	int inv[200010];//逆辺のindex(ecnt)
	int id[100010];//適宜変える(vcnt)
}G;
G g;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}
ll s,t;
void readgraph(){
	//適宜変える
	ll n,m;
	scanf("%lld%lld%lld%lld",&n,&m,&s,&t);
	s--,t--;
	rep(i,0,m){
		ll x,y,z,c;
		scanf("%lld%lld%lld%lld",&x,&y,&z,&c);
		x--,y--,z--;
		g.e[6*i  ].s=x;
		g.e[6*i  ].g=y;
		g.e[6*i  ].c=c;
		g.e[6*i+1].s=y;
		g.e[6*i+1].g=x;
		g.e[6*i+1].c=c;
		g.e[6*i+2].s=x;
		g.e[6*i+2].g=z;
		g.e[6*i+2].c=c;
		g.e[6*i+3].s=z;
		g.e[6*i+3].g=x;
		g.e[6*i+3].c=c;
		g.e[6*i+4].s=y;
		g.e[6*i+4].g=z;
		g.e[6*i+4].c=c;
		g.e[6*i+5].s=z;
		g.e[6*i+5].g=y;
		g.e[6*i+5].c=c;
	}
	g.vcnt=n;
	g.ecnt=6*m;
	qsort(g.e,g.ecnt,sizeof(E),esort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}

//プラキュー（二分ヒープ）（優先度変更ありバージョン）
ll heapN,heap[1<<20],heapinv[1<<20];
int PQhikaku(int i,int j);//jの方が優先度が高いならtrueを返す
void PQchange(int n);
void heap_utod(int n){
	if(2*n>heapN)return;
	int rflag=(2*n+1<=heapN)&&(PQhikaku(2*n,2*n+1));
	if(PQhikaku(n,2*n+rflag)){
		ll temp=heap[2*n+rflag];
		heap[2*n+rflag]=heap[n];
		heap[n]=temp;
		heapinv[heap[n]]=n;
		heapinv[heap[2*n+rflag]]=2*n+rflag;	
		heap_utod(2*n+rflag);
	}
}
void heap_dtou(int n){
	if(n==1||PQhikaku(n,n/2))return;
	ll temp=heap[n];
	heap[n]=heap[n/2];
	heap[n/2]=temp;
	heapinv[heap[n]]=n;
	heapinv[heap[n/2]]=n/2;
	heap_dtou(n/2);
}
ll PQpop(){
	ll rr=heap[1];
	heapinv[heap[1]]=0;
	heap[1]=heap[heapN--];
	heapinv[heap[1]]=1;
	heap_utod(1);
	return rr;
}
void PQpush(ll n){
	heap[++heapN]=n;
	heapinv[heap[heapN]]=heapN;
	heap_dtou(heapN);
}

//早い方のダイクストラ
//グラフと始点を引いて各点への最短距離・最短経路を返す
//プラキューが必要
//O((E+V)logV)
ll daikusutorappp[1<<21];
void daikusutora2(ll s){
	rep(i,0,g.vcnt)daikusutorappp[i]=i==s?0:INF;
	rep(i,0,g.vcnt)PQpush(i);
	while(heapN){
		ll mv=PQpop();
		for(ll t=g.id[mv];t<g.ecnt&&g.e[t].s==mv;t++){
			if(daikusutorappp[g.e[t].g]>daikusutorappp[mv]+g.e[t].c){
				daikusutorappp[g.e[t].g]=daikusutorappp[mv]+g.e[t].c;
				//daikusutorappp[n+g.e[t].g]=mv;//最短経路がいる場合はこれ
				PQchange(g.e[t].g);
			}
		}
	}
}
int PQhikaku(int i,int j){return daikusutorappp[heap[i]]>daikusutorappp[heap[j]];}
void PQchange(int n){if(heapinv[n])heap_dtou(heapinv[n]);}

int main(){
	readgraph();
	daikusutora2(s);
	printf("%lld\n",daikusutorappp[t]);
}


Measured memory_bytes: 29804
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
bool isPrime(ll n) 
{ 
   
   if (n <= 1)  return false; 
   if (n <= 3)  return true; 
 
   if (n%2 == 0 || n%3 == 0) return false; 
 
   for (ll i=5; i*i<=n; i=i+6) 
       if (n%i == 0 || n%(i+2) == 0) 
          return false; 
 
   return true; 
} 
ll minthis(ll a, ll b){
if(a < b){
return a;
}
return b;
}
ll maxthis(ll a, ll b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int b){
   if( a<0 ) a = -a;
   if( b<0 ) b = -b;
   while( b!=0 ){
       a %= b;
       if( a==0 ) return b;
       b %= a;
   }
   return a;
}
 
int findLargestDivisor(int n) 
{ 
int max = 1;
   for (int i = 2; i < n; i++) {        
       if(n %(i) == 0) { 
           max = i;
       } 
    }
   return max;     
} 
 
 
ll power(ll x, ll y)  
{  
   ll temp;  
   if(y == 0)  
       return 1;  
   temp = power(x, y / 2);  
   if (y % 2 == 0)  
       return temp * temp;  
   else
   {  
       if(y > 0)  
           return x * temp * temp;  
       else
           return (temp * temp) / x;  
   }  
} 
bool sortbysec(const pair<int, int>& a, 
               const pair<int, int>& b) 
{ 
   return (a.second < b.second); 
} 
void solve(){
   string s;
  cin >> s;
  ll val = 0;
 for(auto c : s){
    val += c-'0';
 } 
 if(val%9 == 0){
    cout << "Yes" << "\n";return;
 }
 cout << "No" << "\n";
}
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
  return 0; 
}



  


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()



using namespace std;

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

    c -= b;
        if(a <= 0) {cout<<"No"<<endl; return 0;}
    if(c <= 0){ cout<<"Yes"<<endl; return 0;}



    a -= d;
        if(a <= 0) {cout<<"No"<<endl; return 0;}
    if(c <= 0){ cout<<"Yes"<<endl; return 0;}

  }
  
  
  return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
using namespace std;
string a,b;
int main()
{
	cin>>a>>b;
	if(a.length()==b.length()-1&&a==b.substr(0,b.length()-1)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<cstring>
#include<climits>
#include<climits>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=0; i<n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MAX 100005

int n;
ll arr[MAX], dp[MAX]={0};

void bottomUp(){
    dp[1] = abs(arr[1]-arr[0]);
    
    for(int i=2; i<n; i++){
        dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]), dp[i-2]+abs(arr[i]-arr[i-2]));
    }
    cout<<dp[n-1]<<endl;
}

ll solve(int pos){
    if(pos >= n-1) return 0;

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

    ll ans=INT_MAX;
    for(int i=1; i<=2 && (pos+i)<n; i++){
        ans = min(ans, abs(arr[pos]-arr[pos+i])+ solve(pos+i));
    }
    return dp[pos]=ans;
}

void topDown(){
    memset(dp, -1, sizeof(dp));
    cout<<solve(0)<<endl;
}

int main(){
    cin>>n;
    ip(arr, n);
    // bottomUp();
    topDown();
    return 0;
}

Measured memory_bytes: 6528
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [r;d;x] = reads int
    Seq.unfold (fun s -> let n = r * s  - d in Some (n, n)) x
    |> Seq.take 10
    |> Seq.iter (printfn "%i")
    0

Measured memory_bytes: 14288
solve 0 k = 0
solve n k
    | n' < 0 && n'' < n = n''
    | n'' >= n = n
    | otherwise = solve n'' k
        where
            n' = n-k
            n'' = abs n'
main = do
    [n,k] <- map read . words <$> getLine :: IO [Integer]
    print $ solve (mod n k) k


Measured memory_bytes: 3952
N,Ma,Mb=map(int,input().split())
abc=[]
INF=float("inf")
for i in range(N):
    a,b,c=map(int,input().split())
    abc.append((a,b,c))
stack=set([(0,0)])
dp=[[[INF]*(401) for j in range(401)] for i in range(N+1)]
dp[0][0][0]=0
for i in range(N):
    dp[i+1][0][0]=0
    a,b,c=abc[i]
    stack_=set()
    for x,y in stack:
        dp[i+1][x][y]=min(dp[i][x][y],dp[i+1][x][y])
        dp[i+1][x+a][y+b]=min(dp[i+1][x+a][y+b],dp[i][x+a][y+b],dp[i][x][y]+c)
        stack_.add((x+a,y+b))
        stack_.add((x,y))
    stack=stack_
k=1
ans=INF
while(Ma*k<=400 and Mb*k<=400):
    ans=min(dp[N][Ma*k][Mb*k],ans)
    k+=1
if ans==INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 135816
#include <iostream>
#include <iomanip>
#include <cassert>

#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>
using namespace std;

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


void Main()
{
	int N;
	cin >> N;

	int min_c = numeric_limits<int>::max();
	rep(i, N)
	{
		int A;
		cin >> A;
		int count = 0;
		while (A % 2 == 0)
		{
			++count;
			A /= 2;
		}

		min_c = min(count, min_c);
	}

	cout << min_c << endl;
}

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

	Main();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,n) for(int i=s;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ll long long
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
using namespace std;
typedef vector<vector<int> > Graph;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
//abs(x) = (x の絶対値)
//string S  S[i],S += T,S += c,S.size(),S.substr(l),S.substr(l, r)
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1;
//find(all(x), key)boolソート済みのベクトル
//lower_bound(all(x),k)以上,uppper_bound(all(x),k)より大きい
int main(){

    int N;
    cin >> N;
    vl vec;
    rep(i,3*N){
        ll a;
        cin >> a;
        vec.pb(a);
    }
    sort(all(vec));
    ll ans = 0;
    while(vec.size()>N){
        vec.pop_back();
        ans+=vec.back();
        vec.pop_back();
    }

    cout << ans << endl;
    return 0;
}


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

int main()
{
    char name[20];
    scanf("%s", &name);
    if(strcmp(name,"Sunny")==0){
        printf("Cloudy");
    }
    if(strcmp(name,"Cloudy")==0){
        printf("Rainy");
    }
    if(strcmp(name,"Rainy")==0){
        printf("Sunny");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin>>s;
    for (int i=0;i<s.size();i++) {
        if (i==3) {
            cout<<8;
        } else {
            cout<<s.at(i);
        }
    }
    cout<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define pb push_back
#define si second
#define int long long
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define double long double
#define all(o) o.begin(),o.end()
using namespace std;
int n,ele,cur=1;

int32_t main(){
 //   fast

    cin>>n;
    int i;
    vector<int> v(n);
    int z=0;
    for(i=0;i<n;i++)
    {
        cin>>v[i];
        if(v[i]==0)
            z=1;
    }
    if(z==1)
        cout<<"0\n";
    else{
        for(i=0;i<n;i++)
        {
            if(cur>(1e18)/v[i])
            {
                cur=-1;
                break;
            }
            else cur*=v[i];
        }


        if(cur>((int)1e18) || cur==-1)
            cur=-1;
        cout<<cur<<"\n";
    }









    
}




Measured memory_bytes: 4036
#if 0
???????????????????????????Z???Z[1000][1000]??§???????????£??????????????????????????£??????
#endif


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int N,len1,len2;
string X,Y;
int Z[1010][1010];

int main() {
  cin >> N;
  for (int i=0; i<N; i++){
    cin >> X >> Y;
    len1 = X.length();
    len2 = Y.length();
    for (int i=1; i<=len1; i++){
      for (int j=1; j<=len2; j++){
       if (X[i-1] == Y[j-1]){
         Z[i][j] = Z[i-1][j-1] + 1;
       }
       else if (Z[i][j-1] > Z[i-1][j]){
         Z[i][j] = Z[i][j-1];
       }
       else{
         Z[i][j] = Z[i-1][j];
       }
     }
   }
   cout << Z[len1][len2] << endl;
 }
}

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

int main() {
  int N;
  cin >> N;
  if (N == 1)
    cout << 0 << endl;
  else if (N > 1) {
    vector<int> V(N);
    vector<int> D(N);
    int a;
    int m = 0;
    for (int i = 0; i < N; i++) {
      cin >> a;
      V.at(i) = a;
      if (a > m) {
        m = a;
        D.at(i) = a;
      }
      else if (a <= m)
        D.at(i) = m;
    }
    vector<int> A(N);
    for (int i = 0; i < N; i++)
      A.at(i) = D.at(i)-V.at(i);
    long long Ans = 0;
    for (int i = 0; i < N; i++)
      Ans += A.at(i);
    cout << Ans << endl;
  }
}

Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define nl '\n'
#define si(i) scanf("%d", &i)

int nm, ma, su;

int main() {

    cin >> nm;
    for ( int i = 0; i < nm; i++ ) {
        int x; cin >> x;
        ma = max( x, ma);
        su += x;
    }
    if ( ma < su - ma ) cout << "Yes";
    else cout << "No";
}

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

const bool DEBAG = false;
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
    
bool canGoal(string s, ll start, ll goal){
    start --;
    goal --;

    if(s[goal] == '#') return false;
    for(ll i = start; i <= goal - 1; i++ ){
        if(s[i] == '#' && s[i+1] == '#') return false;
    }
    return true;
}

bool canChange(string s, ll funu, ll G_funu){
    G_funu--;
    funu --;

    for(ll i = funu; i <= G_funu; i++ ){
        if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.') return true;
    }
    return false;
}

int main(){
    
    ll N, sunuke, funuke, G_sunuke, G_funuke;
    cin >> N >> sunuke >> funuke >> G_sunuke >> G_funuke;

    string s;
    cin >> s;

    if(G_sunuke > G_funuke){
        if(canChange(s, funuke, G_funuke) == false ){
            if(DEBAG) cout << "flag 1" << endl;
            cout << "No" << endl; 
            return 0;
        }
    }
    if(canGoal(s, sunuke, G_sunuke) && canGoal(s, funuke, G_funuke) ){
            if(DEBAG) cout << "flag 2" << endl;
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define out(a) printf("%lld\n",a)
#define clr(x,y) memset(x,y,sizeof(x))
inline ll read(){
    ll f=1,x=0;char c=getchar();
    while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
#define inf (1<<30)
/*------------------------------------------------------------*/
ll a[maxn],s[maxn];
map<int,int>mp;
int main(){
	int n,m;
	in(n);in(m);
	mp[0]++;
	ll ans=0;
	FOR(i,1,n){
		in(a[i]);
		s[i]=s[i-1]+a[i];
		ans+=mp[s[i]%m];
		mp[s[i]%m]++;
	}
	out(ans);
}

Measured memory_bytes: 4736
n = int(input())
p = list(map(int, input().split()))

for i in range(n):
    for j in range(n):
        temp = p.copy()
        temp[i], temp[j] = temp[j], temp[i]
        sorted_temp = sorted(temp)

        if sorted_temp  == temp:
            print("YES")
            exit()

print("NO")

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main(){
	
	int N;
	cin >> N;
	
	long long int p = 2;
	long long int q = 1;
	
	for(int i = 1; i < N; i++){
		long long int num = q;
		q = p + q;
		p = num;
	}
	
	cout << q << endl;
	
	return 0;
}

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

int main() {
	int W,H,N;
  	cin >> W >> H >> N;
  	
  	vector<vector<int>> area(H,vector<int>(W,0));
  	vector<int> x(N),y(N),a(N);
  
  	for(int i = 0; i < N; i++) {
    	cin >> x.at(i) >> y.at(i) >> a.at(i);
    }
  
  	for(int i = 0; i < N; i++) {
    	if(a.at(i) == 1) {
        	for(int j = 0; j < H;j++) {
            	for(int k = 0; k < x.at(i);k++) {
                	area.at(j).at(k)++;
                }
            }
        }else if(a.at(i) == 2) {
        	for(int j = 0; j < H;j++) {
            	for(int k = x.at(i); k < W; k++) {
                	area.at(j).at(k)++;
                }
            }
        }else if(a.at(i) == 3) {
        	for(int j = H - y.at(i); j < H;j++) {
            	for(int k = 0; k < W; k++) {
                	area.at(j).at(k)++;
                }
            }
        }else if(a.at(i) == 4) {
        	for(int j = 0; j < H - y.at(i);j++) {
            	for(int k = 0; k < W; k++) {
                	area.at(j).at(k)++;
                }
            }
        }
    
    }
  	
  	int ans = 0;
  
  	for(int i = 0; i < H; i++) {
    	for(int j = 0; j < W; j++) {
        	if(area.at(i).at(j) == 0) ans++;
        }
    }
  
  	cout << ans << endl;
  
  	
  	
}

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

int hantei (int);

main(){
  int n,i,count=0;
  int s[10000];

  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&s[i]);
      if(hantei(s[i])==1)
	{
	  count++;
	}    
    }
  printf("%d\n",count);
  return 0;
}

int hantei(int x)
{
  int i=3;
  if(x==2) return 1;
  if(x<2||x%2==0) return 0;
  while (i<=sqrt(x))
    {
      if(x%i==0) return 0;
      i+=2;
    }
  return 1;
}

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


int main(){
  int k; // kこ入力受付
  int x; // xは確実に黒
  int i,count=0;
  char moji[10],j;
  double n=0.0,tmp[100];

  scanf("%d", &k);

  for(i=0;i<k;i++){
    scanf("%lf", &tmp[i]);
  }

  for(i=0;i<k;i++){
    n = n + 1 / tmp[i];
  }

printf("%f", 1 /n);
return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int n;
	int i;
	int a[128], key;
	int left, right, center;
	int count;
	
	while (scanf("%d", &n) && n){
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		scanf("%d", &key); //探す数
		
		left = 0;
		right = n - 1;
		count = 0;
		while (left <= right){
			center = (left + right) / 2;
			
			count++;
			if (a[center] == key){
				break;
			}
			else if (a[center] > key){
				right = center - 1;
			}
			else {
				left = center + 1;
			}
		}
		printf("%d\n", count);
	}
	
	return (0);
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef deque<int> DI;
typedef deque<LL> DLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(a); sll(b); sll(c);
	if( 4 * a * b < (c - a - b) * (c - a - b) && (c - a - b > 0))
		puts("Yes");
	else
		puts("No");
}


Measured memory_bytes: 256
n, m = map(int, input().split())

vector1 = []
vector2 = []


for i in range(n):
        vector1.append(list(map(int, input().split())))

for i in range(m):
    vector2.append(int(input()))

for i in range(n):
    sum = 0
    for j in range(m):
        sum += vector1[i][j] * vector2[j]
    print(sum)


Measured memory_bytes: 6012
#include<stdio.h>
int main(void){
    int n,k,i,a,co=0;
    scanf("%d %d",&n, &k);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        if(a>=k) co++;
    }
    printf("%d\n",co);
    return 0;
}

Measured memory_bytes: 128
#!ruby -palF,
r=[[1,4,"four card"],[2,3,"full house"],[1,1,3,"three card"],[1,2,2,"two pair"],[1,1,1,2,"one pair"]].find{|l|l[0..-2]==$F.group_by{|i|i}.map{|k,v|v.size}.sort}
$_=r ?r[-1]:($F.map!(&:to_i).sort![4]-$F[0]==4||$F[1]-$F[0]==9)?"straight":"null"

Measured memory_bytes: 6108
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll N, M, K; cin >> N >> M >> K;
    vector<ll> A(N+1), B(M+1);
    A[0] = 0;
    B[0] = 0;
    rep(i, N) {
        cin >> A.at(i+1);
        A.at(i+1) += A.at(i);
    }
    rep(i, M) {
        cin >> B.at(i+1);
        B.at(i+1) += B.at(i);
    }
    int x = 0, y = 0;
    ll sum = 0;
    int AS = A.size();
    int BS = B.size();
    int ma = 0;
    for (int i = 0; i < AS; i++) {
        sum = A[i];
        int d = K - sum;
        if (d < 0) continue;
        int left = 0, right = BS;
        while (right - left > 1) {
            ll mid = left + (right - left) / 2;
            if (B[mid] > d) right = mid;
            else left = mid;
        }
        if (sum + B[left] > K) continue;
        ma = max(ma, i+left);
    }
    cout << ma << endl;
}


Measured memory_bytes: 6372
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 N;
    cin>>N;
    vector<pair<int64,int64>> A(N);
    for(int64 i=0;i<N;i++){
        cin>>A[i].first;
        A[i].second=i;
    }
    
    sort(A.begin(),A.end());

    for(int64 i=0;i<N;i++){
        if(i==A[N-1].second){
            cout<<A[N-2].first<<endl;
        }else{
            cout<<A[N-1].first<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 


 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  comuse;
  ll n,k;
  	ci(n>>k)
    FOR(i,1,k+1){
      ll ans=1;
      ans*=combi(n-k+1,i);
      ans*=combi(k-1,i-1);
      ans%=1000000007;
   co(ans)
}
}

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

typedef tuple<int,int,int> trinca;
typedef long long ll;

const int MAXW = 2*1e4 + 10;

vector<trinca> guloso;
ll dp[MAXW];
int N;

int main(){

	cin >> N;
	for(int i = 1;i<=N;i++){
		int w,s,v;
		cin >> w >> s >> v;
		guloso.push_back(make_tuple(s+w,w,v));
	}

	sort(guloso.begin(),guloso.end());

	ll best=0;
	for(trinca davez : guloso){
		int solid = get<0>(davez), w = get<1>(davez);
		ll v = get<2>(davez);
		for(int i =solid-w;i>=0;i--){

				dp[i+w] = max(dp[i+w],dp[i] + v);

				best=max(best,dp[i+w]);

		}
	}


	cout << best << endl;

	return 0;

}


Measured memory_bytes: 3744
import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    String a = scanner.next();
    String b = scanner.next();
    scanner.close();

    if (a.equals(b)) {
      System.out.println("H");
    } else {
      System.out.println("D");
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(){
  int a,b,c;cin>>a>>b>>c;
  int x,y,z;
  x = abs(a-b);
  y = abs(b-c);
  z = abs(c-a);

  int max;
  max = x;
  if(max<y){max=y;}
  if(max<z){max=z;}
  cout<<x+y+z-max<<endl;
}

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

#define _ cin.tie(0);ios::sync_with_stdio(false);
string s,t;

int main(){
  cin>>s>>t;
  vector<int> ss(26,-1);
  vector<int> tt(26,-1);

  REP(i,s.size()){
    int a=s[i]-'a';
    int b=t[i]-'a';
    if(ss[a] != -1 || tt[b] != -1){
      if(ss[a] != b || tt[b] != a){
	cout<<"No"<<endl;
	return 0;
      }
    }

    ss[a] = b;
    tt[b] = a;
  }

  cout<<"Yes"<<endl;
  return 0;

}


Measured memory_bytes: 776
using System;
using System.Collections.Generic;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] A = Console.ReadLine().Split(' ');
            List<int> a = new List<int>();
            int ia = 0;
            int i = 1;
            int j = 1;
            a.Add(0);
            for (j = 0; j < N; j++)
            {
                ia = int.Parse(A[j]);
                a.Add(ia);
            }
            j = 1;i = 1;
            int d = 0;
            while (true)
            {
                if (j < a.Count)
                {
                    if (a[i] == j)
                    {
                        i++; j++;
                        continue;
                    }
                    else
                    {
                        int m = a[i];
                        d++;
                        a.Remove(m);
                    }
                }
                else
                {
                    break;
                }
            }
            if (d == N)
            {
                Console.WriteLine("-1");
            }
            else
            {
                Console.WriteLine(d);
            }
        }
    }
}


Measured memory_bytes: 44480
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0

(0..a).each do |h|
  (0..b).each do |i|
    (0..c).each do |j|
      if 500 * h + 100 * i + 50 * j == x
        count += 1
      end
    end
  end
end

puts count

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef pair<int, pii> pip;

int N, M, H[210], V[210], A, B, C;
pii F[210];
pip E[60000];

class UnionFind {
public:
  vector<int> a;
  UnionFind(int n) { REP(i, 0, n) a.push_back(i); }
  int find(int i) { return a[i] == i ? i : (a[i] = find(a[i])); }
  bool unite(int i, int j) {
    if(find(i) == find(j)) return false;
    a[find(i)] = find(j);
    return true;
  }
};

int main(){
  while(cin >> N >> M, N || M) {
    REP(i, 0, N) cin >> H[i];
    REP(i, 0, N) F[i] = pii(-H[i], i);
    REP(i, 0, N) V[i] = 0;
    REP(i, 0, M) {
      cin >> A >> B >> C;
      A--;
      B--;
      E[i] = pip(C,pii(A,B));
    }
    sort(F, F + N);
    sort(E, E + M);

    UnionFind uf(N);
    int ret = 0, cnt = 0;
    REP(i, 0, N) {
      int v = F[i].se;
      V[v] = 1;
      if(i == N - 1 || F[i].fi != F[i + 1].fi) {
        REP(j, 0, M) {
          int a = E[j].se.fi;
          int b = E[j].se.se;
          if(V[a] && V[b] && uf.unite(a, b)) {
            ret += E[j].fi;
            cnt++;
          }
        }
        if(cnt != i){
          cnt = 0;
          ret = 0;
          REP(j, 0, N) uf.a[j] = j;
        }
      }
    }
    cout << ret << endl;
  }
  return 0;
}

Measured memory_bytes: 3400
n=int(input())
a=list(map(int,input().split()))
a.sort()
s=[0]
si=0
for ai in a:
    si+=ai
    s.append(si)
import bisect
ans=0
#色iにたいして2xAi以下の
for ai in a:
    b0=0
    b1=1
    c=ai
    while b0!=b1:
        b0=b1
        b1=bisect.bisect_right(a,2*c)
        c=s[b1]
    if b1==n:
        ans+=1
print(ans)




Measured memory_bytes: 14228
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<int> vi;

signed main(){
    int c;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> c;
    if(c==25) puts("Christmas");
    else if(c==24) puts("Christmas Eve");
    else if(c==23) puts("Christmas Eve Eve");
    else if(c==22) puts("Christmas Eve Eve Eve");
    return 0;   
}

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

int main(){
  int *A,p,r,n,x,i,j,k;

  scanf("%d",&n);
  A = malloc(sizeof(int)*(n+1));
  for(i=1; i<=n; i++)
    scanf("%d",&A[i]);
  p = 1;
  r = n;

  x = A[r];
  i = p-1;
  for(j=p; j<=r-1; j++){
    if(A[j] <=x){
      i++;
      k = A[i];
      A[i] = A[j];
      A[j] = k;
    }
  }
  k = A[i+1];
  A[i+1] = A[r];
  A[r] =k;

  j = i+1;

  for(i=1; i<=n; i++){
    if(i>1) printf(" ");
    if(i==j) printf("[");
    printf("%d",A[i]);
    if(i==j) printf("]");
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 992
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
const long long MAXVAL = (long long) 1e18 + 1;
const long long MOD = 1000000007ll;
//const long long MOD = 998244353ll;
const int INF = 1000000001;
 
long long poww(int x, long long pow) {
  if (pow == 0ll ) return 1;
  if (pow == 1ll) return x % MOD;
  long long ans = poww(x, pow >> 1) % MOD;
  ans = (ans * ans) % MOD;
  if ((pow & 1) == 1) {
    ans = (ans * x ) % MOD;
  }
  return ans % MOD;
}
 
ll gcd(ll x, ll y) {
  if (x == 0) return y;
  while (y) {
    x %= y;
    swap(x, y);
  }
  return x;
}
 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q = 1;
   //cin >> q;
  while (q-- >0) {
    int a,b,c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    while (b <= a) {
      b <<= 1 ;
      --k;
    }
    while (c <= b) {
      c <<= 1;
      --k;
    }
    if (k < 0) {
      cout << "No\n"; 
    } else cout << "Yes\n";

  }

 
  return 0;
}


Measured memory_bytes: 3648
class Dice
    # constructor
    def initialize(line)
        @figures = line.chomp.split(" ").map(&:to_i)
    end
    
    # Rotate in any direction
    def rotate(direction)
        array = Array.new(6)
        
        case direction
        when "N"
            array[0] = @figures[1]
            array[1] = @figures[5]
            array[2] = @figures[2]
            array[3] = @figures[3]
            array[4] = @figures[0]
            array[5] = @figures[4]
        when "S"
            array[0] = @figures[4]
            array[1] = @figures[0]
            array[2] = @figures[2]
            array[3] = @figures[3]
            array[4] = @figures[5]
            array[5] = @figures[1]
        when "W"
            array[0] = @figures[2]
            array[1] = @figures[1]
            array[2] = @figures[5]
            array[3] = @figures[0]
            array[4] = @figures[4]
            array[5] = @figures[3]
        when "E"
            array[0] = @figures[3]
            array[1] = @figures[1]
            array[2] = @figures[0]
            array[3] = @figures[5]
            array[4] = @figures[4]
            array[5] = @figures[2]
        end
        @figures = Marshal.load(Marshal.dump(array))
    end
    
    # Rotate horizontally
    def turnClockwise()
        array = Array.new(6)
        array[0] = @figures[0]
        array[1] = @figures[2]
        array[2] = @figures[4]
        array[3] = @figures[1]
        array[4] = @figures[3]
        array[5] = @figures[5]
        @figures = Marshal.load(Marshal.dump(array))
    end
    
    def showTop()
        return @figures[0]
    end
    
    def showFront()
        return @figures[1]
    end
    
    def showRight()
        return @figures[2]
    end
end

dice = Dice.new(gets.chomp)
n = gets.to_i

for i in 1..n
    input = gets.chomp.split(" ").map(&:to_i)
    
    # rotate North-South direction
    for j in 1..3
        if dice.showTop() == input[0]
            break
        else
            dice.rotate("N")
        end
    end
    # in case it exists on the side
    while dice.showTop() != input[0]
        dice.rotate("W")
    end
    
    # match the front
    while dice.showFront() != input[1]
        dice.turnClockwise()
    end
    puts dice.showRight()
end


Measured memory_bytes: 6920
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n;

map<string, ll> mp;
ll ans;

int main(void){
	cin>>n;

	for (int i = 0; i < n; i++) {
		string S; cin>>S;

		sort(S.begin(), S.end());

		mp[S]++;
	}

	for (auto ite = mp.begin(); ite != mp.end(); ++ite) {
		if (ite->second >= 2) {
			ll t = ite->second;
			ans += (t * (t - 1)) / 2;
		}
	}

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

Measured memory_bytes: 11136
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	c := make([]int, N+1)
	for i := 0; i <= N; i++ {
		c[i] = 1
	}
	for i := 2; i <= N; i++ {
		c[i]++
		for j := 2 * i; j <= N; j += i {
			c[j]++
		}
	}
	ans := 0
	for i := 1; i <= N; i++ {
		ans += i * c[i]
	}
	fmt.Println(ans)
}

// Sieve returns isPrime, primes
func Sieve(max int) ([]bool, []int) {
	isPrime := make([]bool, max+1)
	for i := 2; i <= max; i++ {
		isPrime[i] = true
	}
	primes := []int{}
	for i := 2; i <= max; i++ {
		if !isPrime[i] {
			continue
		}
		for j := 2 * i; j <= max; j += i {
			isPrime[j] = false
		}
		primes = append(primes, i)
	}
	return isPrime, primes
}


Measured memory_bytes: 82556
n = int(input())
c = [int(input()) for i in range(n)]
s = [0]*n
for i,ci in enumerate(c):
  s[ci-1] = i
cnt = 1
ans = n-1
for i in range(n-1):
  if s[i] < s[i+1]:
    cnt += 1
  else:
    ans = min(n-cnt,ans)
    cnt = 1
ans = min(n-cnt,ans)
print(ans)

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

int main(){
  string s;
  cin>>s;
  if(s[0]!='A'){
    cout<<"WA"<<endl;
    exit(0);
  }
  int wC=-1;
  for(int i=2; i<(int)s.size()-1; i++){
    if(s[i]=='C'){
      wC=i;
      break;
    }
  }
  if(wC==-1){
    cout<<"WA"<<endl;
    exit(0);
  }
  for(int i=1; i<(int)s.size(); i++){
    if(0 > s[i]-'a'&&i!=wC){
      cout<<"WA"<<endl;
      exit(0);
    }
  }
  cout<<"AC"<<endl;
}


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

int main() {
  string s; cin >> s;
  int q; cin >> q;
  bool dir = true; // true = no flips
  vector<char> begin, end;
  while (q--) {
    int t; cin >> t;
    if (t == 1) {
      dir = !dir;
    } else {
      int f; char c; cin >> f >> c;
      if ((dir && f == 1) || (!dir && f == 2)) {
        begin.push_back(c);
      } else if ((dir && f == 2) || (!dir && f == 1)) {
        end.push_back(c);
      }
    }
  }
  
  string ans = "";
  for (int i = begin.size() - 1; i >= 0; i--) {
    ans += begin[i];
  }
  ans += s;
  for (int i = 0; i < end.size(); i++) {
    ans += end[i];
  }
  if (!dir)
    reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1368
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
n = x // 50
for aa in range(a + 1):
    for bb in range(b + 1):
        for cc in range(c + 1):
            val = aa * 10 + bb * 2 + cc
            if val == n:
                count += 1
print(count)


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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using ll = long long;
using namespace std;

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

    int a[3]; REPI(i, 3) cin >> a[i];
    sort(a, a+3);
    cout << a[0] + a[1] << endl;
}


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

namespace ConsoleApp1
{
    public class Program
    {
        static long Count(long max, int bit)
        {
            long ans = max / (long)Math.Pow(2, bit + 1) * (long)Math.Pow(2, bit);
            long remainder = max % (long)Math.Pow(2, bit + 1);
            ans += Math.Max(0, remainder - (long)Math.Pow(2, bit));
            return ans;
        }

        static void Main(string[] args)
        {
            var e = Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();
            long a = e[0], b = e[1];

            long ans = 0;
            for (int bit = 0; bit < 60; bit++)
            {
                long count = Count(b + 1, bit) - Count(a, bit);
                if (count % 2 == 1)
                {
                    ans |= 1L << bit;
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int a[]=new int[3];
        for(int i=0;i<3;i++){
            a[i]=scan.nextInt();
        }
        if(a[2]>=a[0] && a[2]<=a[1])
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 21844
K = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[K-1])

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  scanf("%d",&n);
  long long dp[n+1];
  dp[0]=2;dp[1]=1;
  for(int i=2;i<=n;++i) dp[i]=dp[i-1]+dp[i-2];
  printf("%lld\n",dp[n]);
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifdef LOCAL
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define debug(x) ;
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 3010
#define SIZE2 20010

ll dp[SIZE2];

int main(){
  int n, w[SIZE], s[SIZE], v[SIZE];
  pair<int,int> blocks[SIZE];

  scanf("%d", &n);

  for(int i=0;i<n;i++){
    scanf("%d%d%d", w+i, s+i, v+i);
    blocks[i] = {s[i]+w[i], i};
  }

  sort(blocks, blocks+n);

  for(int i=1;i<SIZE2;i++){
    dp[i] = -LLINF;
  }

  ll ans = 0;

  for(int i=0;i<n;i++){
    int id = blocks[i].second;

    for(int j=s[id];j>=0;j--){
      dp[j+w[id]] = max(dp[j+w[id]], dp[j] + v[id]);
      ans = max(ans, dp[j+w[id]]);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val alMap = mapOf("A" to "T", "C" to "G", "G" to "C", "T" to "A")
    val b = next()
    println(alMap[b])
}

fun next() = readLine()!!

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 33564
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll a,b,c;cin>>a>>b>>c;
    if(4*a*b<(c-a-b)*(c-a-b) and c-a-b>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<set>
using namespace std;
const int maxn=1005;
const int INF=0x3f3f3f3f;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};
int n,m;
char s[maxn][maxn];
int cnt,col[maxn][maxn];
void dfs(int x,int y)
{
    col[x][y]=cnt;
    for(int i=0;i<4;i++)
    {
        int p=x+dx[i],q=y+dy[i];
        if(0<=p&&p<n&&0<=q&&q<m&&s[p][q]=='.'&&!col[p][q])
            dfs(p,q);
    }
    return;
}
set<int> nei[maxn*maxn];
int dis[maxn*maxn],que[maxn*maxn];
int main()
{
    scanf("%d%d",&n,&m);
    int sx,sy,ex,ey;
    scanf("%d%d%d%d",&sx,&sy,&ex,&ey);
    sx--; sy--; ex--; ey--;
    for(int i=0;i<n;i++)
        scanf("%s",s[i]);
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            if(s[i][j]=='.'&&!col[i][j])
            {
                cnt++;
                dfs(i,j);
            }
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            for(int r=-2;r<=2;r++)
                for(int c=-2;c<=2;c++)
                {
                    int p=i+r,q=j+c;
                    if(0<=p&&p<n&&0<=q&&q<m&&col[p][q]&&col[p][q]!=col[i][j])
                        nei[col[i][j]].insert(col[p][q]);
                }
    int head=0,tail=0;
    que[tail++]=col[sx][sy];
    memset(dis,0x3f,sizeof(dis));
    dis[col[sx][sy]]=0;
    while(head<tail)
    {
        int cur=que[head++];
        for(set<int>::iterator it=nei[cur].begin();it!=nei[cur].end();it++)
        {
            int next=*it;
            if(dis[cur]+1<dis[next])
            {
                dis[next]=dis[cur]+1;
                que[tail++]=next;
            }
        }
    }
    printf("%d\n",dis[col[ex][ey]]==INF?-1:dis[col[ex][ey]]);
    return 0;
}


Measured memory_bytes: 84612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define allR(x) (x).rbegin(), (x).rend()
using ll = long long;
using P = pair<int, int>;
const int INF (1<<30);
const ll l18 = 1'000'000'000'000'000'000;

int main() {
  ll N;
  cin >> N;
  vector<double> A(N);
  rep(i, N) cin >> A[i];

  double ans = 1LL;

  rep(i, N) {
    ans *= A[i];
  }

  if (ans > l18) {
    cout << -1 << endl;
  } else {
    ll a = 1LL;
    rep(i, N) a *= (ll)A[i];
    if (a <= l18) cout << a << endl;
    else cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 4052
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
ll fact(int n){
	ll ans=1;
	FOR(i,1,n+1){
		ans*=i;
		ans%=M;
	}
	return ans;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
	COMinit();
	int h,w,a,b;
	cin>>h>>w>>a>>b;//h行w列
	int cl=h-a-1;
	//cout<<COM(100000,500)<<endl;
	ll ans=COM(h+w-2,h-1);
	//cout<<ans<<endl;
	ll minus=0;
	int cnt=0;
	for(int i=b; i>0;i--){
		cnt++;
		if(cnt<=a){
			//cout<<cl+cnt+i-1<<" "<<i-1<<" "<<h-(cl+cnt)+w-i-1<<" "<<w-i<<endl;
			ll tmp=COM(cl+cnt+i-1,i-1)%M;
			ll tmp2=COM(h-(cl+cnt)+w-i-1,w-i)%M;
			tmp=tmp*tmp2%M;
			minus+=tmp;
			minus%=M;
			//cout<<ans<<endl;
		}else{
			break;
		}
	}
	//cout<<minus<<endl;
	if(minus>ans){
		ans+=M;
	}
	ans=ans-minus%M;
	//ans=max(ans,M-ans);
	cout<<ans%M<<endl;
}


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

int main()
{
    long long N;
    cin >> N;
    long long end = sqrt(N)+1;
    int ans = 1000;
    for(int i=1; i<=end; i++){
        if(N%i == 0){
            int c = N/i;
            string s,t;
            s = to_string(c);
            t = to_string(i);
            int a=s.size();
            int b=t.size();
            ans = min(ans,max(a,b));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

struct Block {
  ll w, s, v;
  Block(ll w, ll s, ll v) : w(w), s(s), v(v) {}
};

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

int main() {
  ll n;
  cin >> n;
  vector<Block> blocks;
  ll sMax = 0;
  REP(i, n) {
    ll w, s, v;
    cin >> w >> s >> v;
    blocks.push_back(Block(w, s, v));
    chmax(sMax, s);
  }
  sort(ALL(blocks),
       [](Block b1, Block b2) { return b2.s - b1.w > b1.s - b2.w; });

  vector<vector<ll>> dp(2, vector<ll>(sMax + 2, -1));
  dp[0][0] = 0;
  REP(i, n) REP(j, sMax + 2) {
    ll ci = i % 2, ni = !ci;
    if (dp[ci][j] == -1) {
      continue;
    }
    chmax(dp[ni][j], dp[ci][j]);
    if (j <= blocks[i].s) {
      chmax(dp[ni][min(j + blocks[i].w, sMax + 1)], dp[ci][j] + blocks[i].v);
    }
  }
  ll ans = 0;
  REP(j, sMax + 2) { ans = max(ans, dp[n % 2][j]); }
  cout << ans << endl;
}

Measured memory_bytes: 512