akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <math.h>
#include <set>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const double PI = 3.1415926535897932384626433;

///////////////////////////
////Prime Creator//////////
///////////////////////////
//bool Prime[100001] = {};
//void createPrime() {
//	ll n = 100001;
//	rep(i, 0, n) Prime[i] = true;
//	Prime[0] = false;
//	Prime[1] = false;
//	rep(i, 2, n) {
//		if (Prime[i]) {
//			rep(j, 2, n) {
//				if (j*i >= n)break;
//				Prime[j*i] = false;
//			}
//		}
//	}
//}
///////////////////////////
///////////////////////////

/////////////////////////
//Warshal Floyid/////////
/////////////////////////
//initialize`
//rep(i, 0, N)rep(j, 0, N) wf[i][j] = 1 << 29;
//static const ll WF_MAX = 300;
//ll wf[WF_MAX][WF_MAX];
//void WarshalFloyid(int size) {
//	rep(k, 0, size)rep(i, 0, size)rep(j, 0, size)wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
//}

////////////
///dijkstra
///////////
//ll N;
//static const ll MAX = 100001;
//static const ll INFTY = (ll)1 << 55;
//static const int WHITE = 1;
//static const int GRAY = 2;
//static const int BLACK = 3;
//vector<pair<int, int>>adj[MAX];
//ll d[MAX];
//ll pre[MAX];
//
//priority_queue<pair<int, int>>PQ;
//int color[MAX];
//ll n;
//void dijkstra(ll x) {
//	repe(i, 1, n) {
//		d[i] = INFTY;
//		color[i] = WHITE;
//	}
//
//	d[x] = 0;
//	PQ.push(make_pair(x, x));
//	color[x] = GRAY;
//	while (!PQ.empty()) {
//		pair<ll, ll> f = PQ.top(); PQ.pop();
//		ll u = f.second;
//		color[u] = BLACK;
//
//		if (d[u] < f.first * (-1))continue;
//
//		rep(j, 0, adj[u].size()) {
//			ll v = adj[u][j].first;
//			if (color[v] == BLACK)continue;
//			if (d[v] > d[u] + adj[u][j].second) {
//				d[v] = d[u] + adj[u][j].second;
//				pre[v] = u;
//				PQ.push(make_pair(d[v] * (-1), v));
//
//				color[v] = GRAY;
//			}
//		}
//	}
//}
//vector<ll> get_path(ll t) {
//	vector<ll> path;
//	for (; t != -1; t = pre[t])path.push_back(t);
//	reverse(path.begin(), path.end());
//	return path;
//}

int main() {
	ll H, W, N; cin >> H >> W >> N;
	ll a[10000] = {};
	ll m[100][100] = {};
	rep(i, 0, N)cin >> a[i];
	ll c = 1;
	bool r = true;
	ll h = 0, w = 0;
	rep(i, 0, N) {
		rep(j, 0, a[i]) {
			if (r) {
				m[h][w++] = c;
			}
			else {
				m[h][w--] = c;
			}

			if (w == W || w == -1) {
				if (w == W) {
					w--;
				}
				else {
					w++;
				}
				r = r ? false : true;

				h++;
			}
		}
		c++;
	}
	rep(h, 0, H) {
		rep(w, 0, W) {
			cout << m[h][w];
			if (w != W - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define lowbit(x) ((x) & (- (x)))
#define rev(x) (((1 << n) - 1) ^ x)
#define R register
using namespace std;
const int N = 15, MAX = 1 << 15, MAX3 = 14348907, INF = 0x3f3f3f3f;
int n,m,su[N+2][MAX],dp[MAX][N + 2],trans[MAX],co[MAX3];
int main() {
  int x,y,z;
  scanf("%d%d",&n,&m);
  for (int i = 1 ; i <= m ; ++ i) {
    scanf("%d%d%d",&x,&y,&z);
    su[x][1 << y >> 1] += z;
    su[y][1 << x >> 1] += z;
  }
  for (int i = 1 ; i <= n ; ++ i)
    for (R int j = 1 ; j < (1 << n) ; ++ j)
      su[i][j] = su[i][j - lowbit(j)] + su[i][lowbit(j)];
  for (R int i = 1 ; i < (1 << n) ; ++ i) {
    for (int j = 1, t = 1 ; j <= n ; ++ j, t *= 3) 
      if ((i >> j-1)&1) trans[i] += t;
  }
  for (R int i = 1 ; i < (1 << n) ; ++ i)
    for (R int j = rev(i) ; j ; j = (j-1)&rev(i)) {
      int t = trans[i] + 2 * trans[j];
      for (int k = 1 ; k <= n ; ++ k)
        if ((i >> k-1)&1) co[t] += su[k][j];
    }
  memset(dp,0x3f,sizeof dp);
  dp[1][1] = 0;
  for (R int i = 1 ; i < (1 << n) ; ++ i) {
    for (int j = 1 ; j <= n ; ++ j) if ((i >> j-1)&1) {
      if (dp[i][j] == INF) continue;
      for (R int k = rev(i) ; k ; k = (k-1)&rev(i)) if (su[j][k] > 0)
        dp[i | k][j] = min(dp[i|k][j],dp[i][j]+co[trans[i^(1<<j>>1)]+2*trans[k]]);
      if ((i >> n-1)&1) continue;
      for (int k = 1 ; k <= n ; ++ k) if (!((i >> k-1)&1)) if (su[k][1<<j>>1] > 0)
        dp[i|(1<<k>>1)][k] = min(dp[i|(1<<k>>1)][k],dp[i][j]+su[k][i^(1<<j>>1)]);
    }
  }
  printf("%d\n",dp[(1 << n) - 1][n]);
  return 0;
}

Measured memory_bytes: 60672
N,M=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
mod=10**9+7
x=0
for i in range(N):
    x+=((i-(N-i-1))*X[i])%mod
    x%=mod
y=0
for j in range(M):
    y+=((j-(M-j-1))*Y[j])%mod
    y%=mod
print((x*y)%mod)

Measured memory_bytes: 18576
#include<stdio.h>

int main(void)
{
	int i;
	int x[1000]={0},y[1000]={0},z[1000]={0},hantei[1000];
	int j=0,e=0;

	scanf("%d",&i);

	while(j!=i)
	{
		scanf("%d %d %d",&x[j],&y[j],&z[j]);

		j=j+1;
	}

	for(i=0;i<j;i++)
	{
		if(y[i]<x[i] && z[i]<x[i])
		{
			if(x[i]*x[i] == y[i]*y[i]+z[i]*z[i])
				hantei[i]=1;
			else
				hantei[i]=0;
		}
		else if(x[i]<y[i] && z[i]<y[i])
		{
			if(y[i]*y[i] == x[i]*x[i]+z[i]*z[i])
				hantei[i]=1;
			else
				hantei[i]=0;
		}
		else
		{
			if(z[i]*z[i] == x[i]*x[i]+y[i]*y[i])
				hantei[i]=1;
			else
				hantei[i]=0;
		}
	}
	for(i=0;i<j;i++)
	  {   
	   switch(hantei[i])
	    {
		   case 0:
			  printf("NO\n");
			  break;
		   case 1:
			  printf("YES\n");
		      break;
		   default:
			   break;
	   }
	}

	return 0;
}

Measured memory_bytes: 1024
N = gets.to_i
as = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)
time = bs.inject(:+) - as.inject(:+)
adiff, bdiff = 0, 0
N.times do |i|
    if as[i] < bs[i]
        adiff += (bs[i]-as[i]+1)/2
    else
        bdiff += as[i]-bs[i]
    end
end
if [adiff, bdiff].max <= time
    puts 'Yes'
else
    puts 'No'
end

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll int
#define lpl long long 
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second

using namespace :: std;

const ll maxn=1e5+500;
const ll mod=1e9+7;
const ll inf=1e9+500;

ll a[maxn];
ll b[maxn];
int main(){
	ll n;
	lpl ans=0;
	cin>>n;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
		b[i]=a[i];
	}
	ll q=n/4+1;
	for(ll i=n;i>=q;i--){
		lpl s=a[i];
		for(ll j=2*i;j<=n;j+=i){
			s+=a[j];
		}
		if(s<0){
			for(ll j=i;j<=n;j+=i){
				a[j]=0;
			}
		}	
	}
	for(ll i=n;i>=q;i--){
		lpl s=a[i];
		for(ll j=2*i;j<=n;j+=i){
			s+=a[j];
		}
		if(s<0){
			for(ll j=i;j<=n;j+=i){
				a[j]=0;
			}
		}	
	}
	for(ll i=n;i>=q;i--){
		lpl s=a[i];
		for(ll j=2*i;j<=n;j+=i){
			s+=a[j];
		}
		if(s<0){
			for(ll j=i;j<=n;j+=i){
				a[j]=0;
			}
		}	
	}
	for(ll i=n;i>=q;i--){
		lpl s=a[i];
		for(ll j=2*i;j<=n;j+=i){
			s+=a[j];
		}
		if(s<0){
			for(ll j=i;j<=n;j+=i){
				a[j]=0;
			}
		}	
	}
	vector<ll> vec;
	for(ll i=1;i<=n ;i++){
		if(a[i]<0){
			vec.pb(i);
		}
	}
	if(vec.size()==0){
		lpl s=0;
		for(ll i=1;i<=n;i++){
			s+=a[i];
		}
		cout<<s;
		return 0;
	}
	if(vec.size()>25){

		cout<<a[mod];

	}
	for(ll i=1;i<=n;i++){
		b[i]=a[i];
	}
	ll t=vec.size();
	for(ll mask=0;mask<(1<<t);mask++){
		lpl s=0;
		for(ll i=0;i<t;i++){
			if((mask>>i)&1){
				ll v=vec[i];
				for(ll j=v;j<=n;j+=v){
					a[j]=0;
				}
			}
		}
		for(ll i=1;i<=n;i++){
			s+=a[i];
			a[i]=b[i];
		}
		ans=max(ans,s);
	}
	cout<<ans;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        switch (S){
            case "SUN":
                System.out.println(7);
                break;
            case "MON":
                System.out.println(6);
                break;
            case "TUE":
                System.out.println(5);
                break;
            case "WED":
                System.out.println(4);
                break;
            case "THU":
                System.out.println(3);
                break;
            case "FRI":
                System.out.println(2);
                break;
            case "SAT":
                System.out.println(1);
                break;
        }

    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<string>
using namespace std;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int min = N;
  int countw = 0;
  int counte = 0;
  for(int i = 0; i < N; ++i){
    if(S[i] =='E') ++counte; 
  }
  for(int i = 0; i < N; ++i){
    if(S[i-1] == 'W') ++countw;
    if(S[i] == 'E') --counte;
    if(min > countw + counte) min = countw + counte;
  }
  cout << min << endl;
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int sum=0,fushu=1;
	char c=getchar();
	while(!isdigit(c)){
		if(c=='-') fushu=-fushu;
		c=getchar();
	}
	while(isdigit(c)){
		sum=sum*10+(c^48);
		c=getchar();
	}
	return sum*fushu;
}
void write(int x){//只能输出非负整数！！！比赛的时候看清楚！！！ 
	if(x>=10) write(x/10);
	putchar(x%10+48);
}
inline void writeln(int x){
	write(x);
	putchar('\n');
}
int n,k;
long double ans;
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		int temp=i;
		long double tot=1.0;
		while(temp<=k-1)
		  temp<<=1,tot/=2.0;
		ans+=tot;
	}
	printf("%.12Lf\n",ans/n);
	return 0;
}

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


int main(){
	string S;
	cin >> S;
	if(S[2]==S[3]&&S[4]==S[5]) cout << "Yes" << endl;
	else cout << "No" << endl;
}












Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A,B;
    cin >> A >> B;
    int N = A.size();
    if(count(B.begin(),B.end(),'1')==0){
        cout << (count(A.begin(),A.end(),'1')==0? 0:-1) << "\n";
        return 0;
    }
    vec<int> L(N),R(N);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++) if(B[(i+j)%N]=='1'){
            R[i] = j;
            break;
        }
        for(int j=0;j<N;j++) if(B[(i-j+N)%N]=='1'){
            L[i] = j;
            break;
        }
    }

    int inf = 1e9;
    auto calc = [&](vec<int>& l,vec<int>& r,int br){
        map<int,int> ml,mr;
        int n = l.size();
        if(!n) return br;
        for(int i=0;i<n;i++){
            if(ml.count(l[i])) ml[l[i]] = max(ml[l[i]],r[i]);
            else ml[l[i]] = r[i];
        }
        int ans = br-ml.begin()->first;
        int rmax = br;
        for(auto& [a,b]:ml){
            ans = min(ans,rmax-a);
            rmax = max(rmax,b);
        }
        return ans;
    };

    int ans = inf;
    for(int j=0;j<=N;j++){
        int now = j;
        vec<int> l,r;
        for(int i=0;i<N;i++){
            if(A[i]!=B[(i+j)%N]){
                now++;
                if(L[i]>0 && j<R[i]){
                    l.push_back(-L[i]);
                    r.push_back(R[i]);
                }
            }
        }
        now += 2*(calc(l,r,j)-j);
        ans = min(ans,now);
    }

    for(int j=0;j<=N;j++){
        int now = j;
        vec<int> l,r;
        for(int i=0;i<N;i++){
            if(A[i]!=B[(i-j+2*N)%N]){
                now++;
                if(j<L[i] && R[i]>0){
                    l.push_back(-R[i]);
                    r.push_back(L[i]);
                }
            }
        }
        now += 2*(calc(l,r,j)-j);
        ans = min(ans,now);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3744
n = int(input())
l = [0]*n
for i in range(n):
  l[i] = int(input())
l.sort()

s = sum(l)
if s%10 != 0:
  print(s)
else:
  for i in range(n):
    if l[i]%10 != 0:
      print(s-l[i])
      exit()
  else:
    print(0)
    exit()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
int main(void){
    int n;
    cin>>n;
    vector<int> h(n),dp(n+1);
    rep(i,0,n)cin>>h[i];
    dp[0]=0;dp[1]=abs(h[0]-h[1]);
    rep(i,2,n){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

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

int A, B;
int main(){
    cin >> A >> B;
    int num = 0;
    if (A >= B){
        num += A;
        A -= 1;
    }
    else{
        num += B;
        B -= 1;
    }
    if (A >= B){
        num += A;
        A -= 1;
    }
    else{
        num += B;
        B -= 1;
    }
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define lb(v,x) lower_bound(all(v),x)
#define ub(v,x) upper_bound(all(v),x)
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

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

const int N = 405;

ll dp[N][N];

int main(){
    IOS
    
    int n;
    cin>>n;
    ll a[n+1];
    a[0]=0;
    FOR(i,1,n+1){
        cin>>a[i];
        dp[i][i]=a[i];
        a[i]+=a[i-1];
    }
    FOR(len,2,n+1){
        FOR(i,1,n-len+2){
            int j=i+len-1;
            dp[i][j]=(1LL<<61);
            FOR(k,i,j){
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+a[j]-a[i-1]);
            }
        }
    }
    cout<<dp[1][n]-a[n];
    cerr<<1.0/CLOCKS_PER_SEC<<endl;
    return 0;
}

Measured memory_bytes: 1536
s = input()

flag = 0
for i in range(len(s)):
	if (s[i] == "U" or s[i] == "D"):
		continue
	if (i % 2 == 0):
		if (s[i] == "R"):
			continue
	else:
		if (s[i] == "L"):
			continue
	flag = -1
	break
if (flag == 0):
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>

using namespace std;

int c[51][51];

void deep(int i,int n){
  if(c[i][n+1]==1){
    c[i][n+1]=2;
    deep(i,n+1);
  }
  if(c[i+1][n]==1){
    c[i+1][n]=2;
    deep(i+1,n);
  }
  if(c[i][n-1]==1){
    c[i][n-1]=2;
    deep(i,n-1);
  }
  if(c[i-1][n]==1){
    c[i-1][n]=2;
    deep(i-1,n);
  }
  if(c[i+1][n+1]==1){
    c[i+1][n+1]=2;
    deep(i+1,n+1);
  }
  if(c[i+1][n-1]==1){
    c[i+1][n-1]=2;
    deep(i+1,n-1);
  }
  if(c[i-1][n+1]==1){
    c[i-1][n+1]=2;
    deep(i-1,n+1);
  }
  if(c[i-1][n-1]==1){
    c[i-1][n-1]=2;
    deep(i-1,n-1);
  }
}

int main(){
  while(1){
    for(int i=0;i<51;i++){
      for(int n=0;n<51;n++){
          c[i][n]=0;
      }
    }
    int w,h;
    int num=0;

    scanf("%d%d",&w,&h);
    if(w==0&&h==0)break;

    for(int i=0;i<h;i++){
      for(int n=0;n<w;n++){
          scanf("%d",&c[i][n]);
      }
    }

    for(int i=0;i<h;i++){
      for(int n=0;n<w;n++){
          if(c[i][n]==1){
            num++;
            deep(i,n);
          }
      }
    }

    printf("%d\n",num);
  }
  return 0;
}



Measured memory_bytes: 3344
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;
const int N=3e5+10;
int a[N],b[N];
map<pair<int,int>,bool>f;
vector<int>ax,bx;
int main()
{
	int n,m,k;
	cin>>n>>m>>k;
	int ma=0,mb=0;
	for(int i=0;i<k;i++){
		int x,y; cin>>x>>y;
		a[x]++;
		b[y]++;
		ma=max(ma,a[x]);
		mb=max(mb,b[y]);
		f[make_pair(x,y)]=1;
	}
	for(int i=1;i<=n;i++){
		if(ma==a[i]){
			ax.push_back(i);
		}
	}
	for(int i=1;i<=m;i++){
		if(mb==b[i]){
			bx.push_back(i);
		}
	}
	int res=0;
	for(auto i:ax){
		for(auto j:bx){
			res=max(res,a[i]+b[j]-f[make_pair(i,j)]);
			if(f[make_pair(i,j)]==0)
				break;
		}
	}
	cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 45476
#include<stdio.h>

int f[45];

void fib(int n, int m){
  if(n>=2){
    f[n]=f[n-1]+f[n-2];
  }
  if(n!=m){
    fib(n+1,m);
  }
}

int main(){
  int i,n,ans;
  
  scanf("%d",&n);

  f[0]=f[1]=1;

  if(n== 0 || n== 1){
    f[n]=1;
  }
  else{
    fib(2,n);
  }
  
  printf("%d\n",f[n]);
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,x,y;
    cin>>n;
    rep(i,n){
        ll t,a;
        cin>>t>>a;
        if(i==0){
            x=t,y=a;
            continue;
        }
        x=t*max((x+t-1)/t,(y+a-1)/a);
        y=a*max((x+t-1)/t,(y+a-1)/a);
    }
    cout<<x+y;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		char[] array = a.toCharArray();
		int count = 0;
		for(int i = 0; i < array.length - 1; i++) {
			for(int j = i + 1; j < array.length; j++) {
				if(array[i] == array[j]) {
					count++;
				}
			}
		}
		if(count == 2) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23764
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define INF 0x3f3f3f3f
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl
using namespace std;

int main(void)
{
    #ifdef test
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //test

    int n,m,sum=0;scanf("%d%d",&n,&m);
    sum+=(1+n-1)*(n-1)/2+(1+m-1)*(m-1)/2;
    printf("%d\n",sum);

    #ifdef test
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n\n\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //test
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━


Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
int main(void)
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(c>=a&&b>=c){
	
	printf("Yes\n");
	
}else{
	printf("No\n");
	
	
}
	return 0;
}

Measured memory_bytes: 128
(* range l r == [l; l+1; ...; r] *)
let range l r =
  let rec go acc l r =
    if l > r then acc else go (l :: acc) (l + 1) r
  in go [] l r

let solve l r d =
  List.length @@ List.filter (fun n -> n mod d == 0) @@ range l r

let () =
  Scanf.scanf "%d %d %d" @@ fun l r d ->
  print_int @@ solve l r d;
  print_newline ()


Measured memory_bytes: 3804
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };


int main() {
	int x, y, z, k;
	cin >> x >> y >> z >> k;

	vector<ll>a(x);
	vector<ll>b(y);
	vector<ll>c(z);
	rep(i, 0, x)cin >> a[i];
	rep(i, 0, y)cin >> b[i];
	rep(i, 0, z)cin >> c[i];
	sort(all(a));
	sort(all(b));
	sort(all(c));
	reverse(all(a));
	reverse(all(b));
	reverse(all(c));

	priority_queue<Data>que;
	set<Data>st;
	que.push(Data(a[0]+b[0]+c[0], vector<int>{0,0,0}));
	st.insert(Data(a[0] + b[0] + c[0], vector<int>{0, 0, 0}));
	rep(i, 0, k) {
		auto h = que.top();
		que.pop();
		cout << h.first << endl;
		int p = h.second[0];
		int q = h.second[1];
		int r = h.second[2];
		if (p + 1 < x) {
			ll sum = a[p + 1] + b[q] + c[r];
			vector<int>ind = { p + 1,q,r };
			auto d = Data(sum,ind);
			if (st.count(d) == 0) {
				que.push(d);
				st.insert(d);
			}
		}
		if (q + 1 < y) {
			ll sum = a[p] + b[q+1] + c[r];
			vector<int>ind = { p,q+1,r };
			auto d = Data(sum, ind);
			if (st.count(d) == 0) {
				que.push(d);
				st.insert(d);
			}
		}
		if (r + 1 < z) {
			ll sum = a[p] + b[q] + c[r+1];
			vector<int>ind = { p,q,r+1 };
			auto d = Data(sum, ind);
			if (st.count(d) == 0) {
				que.push(d);
				st.insert(d);
			}
		}

	}

	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a[100005];cin>>a;
	int s=strlen(a);int sum=0;
	if(s%2!=0){
		cout<<"No";return 0;
	}
	for(int i=0;i<s;i++){
		if(a[i]=='p'&&a[s-i-1]=='q')sum++;
		if(a[i]=='q'&&a[s-i-1]=='p')sum++;
		if(a[i]=='d'&&a[s-i-1]=='b')sum++;
		if(a[i]=='b'&&a[s-i-1]=='d')sum++;
	}
	if(sum==s)cout<<"Yes";
	else cout<<"No";
	return 0;
} 

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	int n, t;
	cin >> n >> t;

	vector<int> a;
	for(int i=0; i<n; i++){
		int tmp;
		cin >> tmp;
		a.pb(tmp);
	}

	int ans = 0;
	int merit = 0;
	int mi = 1000000009;
	for(int i=0; i<n; i++){
		if(mi > a[i]){
			mi = a[i];
		}else if(a[i] - mi > merit){
			merit = a[i] - mi;
			ans = 1;
		}else if(a[i] - mi == merit){
			ans++;
		}
	}

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


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007


typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	string str;
	cin >> str;
	int ans = 0;
	REP(i,3)if(str[i] == 'o')ans++;
	
	cout << 700 + ans*100 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-9
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int a,b;
	scan(a>>b);
	if(b==1){
		prin(0);
		return 0;
	}
	int now=a;
	int ans=1;
	while(now<b){
		now+=a-1;
		ans++;
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
N, A, B, C = map(int, input().split())

S = ['']*N
for i in range(N):
  S[i] = input()
  
play = [''] * N
flag = True
for i, s in enumerate(S):
  next = ''
  if i < len(S)-1:
    next = S[i+1]
  if s == 'AB':
    if A == 0 and B == 0:
      flag = False
      break
    elif A == B and 'B' in next:
      A -= 1
      B += 1
      play[i] = 'B'
    elif A > B:
      A -= 1
      B += 1
      play[i] = 'B'
    else:
      A += 1
      B -= 1
      play[i] = 'A'
  elif s == 'AC':
    if A == 0 and C == 0:
      flag = False
      break
    elif A == C and 'C' in next:
      A -= 1
      C += 1
      play[i] = 'C'
    elif A > C:
      A -= 1
      C += 1
      play[i] = 'C'
    else:
      A += 1
      C -= 1
      play[i] = 'A'
  else:
    if B == 0 and C == 0:
      flag = False
      break
    elif B == C and 'C' in next:
      B -= 1
      C += 1
      play[i] = 'C'
    elif B > C:
      B -= 1
      C += 1
      play[i] = 'C'
    else:
      B += 1
      C -= 1
      play[i] = 'B'

if flag:
  print('Yes')
  for i in play:
    print(i)
else:
  print('No')

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

int main() {
    string A, B;
    cin >> A;
    cin >> B;
    int la = (int)A.length();
    int lb = (int)B.length();
    string ans = "EQUAL";
    if (la > lb){
        ans = "GREATER";
    }
    else if (lb > la){
        ans = "LESS";
    }
    else {
        int a, b;
        for (int l=0; l < la; l++){
            a = int(A[l]);
            b = int(B[l]);
            if (a > b) {
                ans = "GREATER";
                break;
            }
            else if (b > a){
                ans = "LESS";
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int64_t lucas(int N,vector<int64_t> &c){
  if(c[N]==0){
    c[N] = lucas(N-1,c) + lucas(N-2,c);
    return c[N];
  }
  else if(c[N]!=0) return c[N];
}
int main(){
  int N;
  cin >> N;
  vector<int64_t> c(N+1,0);
  c[0] = 2;
  c[1] = 1;
  lucas(N,c);
  cout << c[N] << endl;
}
  
  

Measured memory_bytes: 256
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (ll i = ll(a); i <= ll(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
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; }
// template end

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b;
    in >> a >> b;

    out << (a+b)%24 << endl;
}


Measured memory_bytes: 256
def partition(A,p,r):
    x = A[r]
    i = p - 1

    for j in range(p,r):
        if A[j] <= x:
            i += 1
            temp = A[i]
            A[i] = A[j]
            A[j] = temp
    temp = A[i + 1]
    A[i + 1] = A[r]
    A[r] = temp

    return i + 1

if __name__ == '__main__':
    n = int(input())
    A = list(map(int, input().split()))
    q = partition(A,0,n - 1)

    for i in range(n):
        if i:
            print(" ", end="")
        if i == q:
            print("[", end="")
        if i == n - 1:
            print(A[i])
        else:
            print(A[i], end="")
        if i == q:
            print("]", end="")



Measured memory_bytes: 16384
#include <iostream>

using namespace std;

int data[50], n, r, p, c, tmp[50], next[50];

main(){
  while(cin >> n >> r && (n|r)){
    for(int i=0;i<n;i++) data[i] = n-i;
    for(int i=0;i<r;i++){
      cin >> p >> c;
      for(int j=0;j<p-1;j++) tmp[j] = data[j];
      for(int j=0;j<c;j++) next[j] = data[p-1+j];
      for(int j=0;j<p-1;j++) next[c+j] = tmp[j];
      for(int j=p+c-1;j<n;j++) next[j] = data[j];
      for(int j=0;j<n;j++) data[j] = next[j];
    }
    cout << data[0] << endl;
  }
}

Measured memory_bytes: 0
def prime(n):
    is_prime=[True]*(n+1)
    is_prime[0],is_prime[1]=False,False
    for i in range(2,int(n**0.5)+1):
        if not is_prime[i]:continue
        for j in range(i*2,n+1,i):
            is_prime[j]=False
    return [i for i in range(n+1) if is_prime[i]]

prime_number=prime(10**5)
number=[i for i in prime_number if (i+1)//2 in prime_number]+[0]
ans=[0]*(10**5+1)
count=0

for i in range(1,10**5):
    ans[i]=ans[i-1]
    if i==number[count]:
        ans[i] +=1
        count +=1

for i in range(int(input())):
    a,b=map(int,input().split())
    print(ans[b]-ans[a-1])

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

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

struct Book {
  int C;
  vector<int> A;
};

#define INF 10000000

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N, M, X;
  cin >> N >> M >> X;
  
  vector<Book> book_vector(N);
  for (auto i = 0; i < N; ++i) {
    READ(book_vector[i].C);
    book_vector[i].A.resize(M);
    for (auto j = 0; j < M; ++j) {
      READ(book_vector[i].A[j]);
    }
  }
  
  // main procedure
  int ans = INF;
  // state: bit<n> = 0:本nを買わない, 1:本nを買う
  for (auto state = 1; state < (1 << N); ++state) {
    int current_C = 0;
    vector<int> current_A(M, 0);

    for (auto j = 0; j < N; ++j) {
      if ((state & (1 << j)) != 0) {
        current_C += book_vector[j].C;
        for (auto k = 0; k < M; ++k) {
          current_A[k] += book_vector[j].A[k];
        }
      }
    }

    bool is_learned_well = true;

    for (auto j = 0; j < M; ++j) {
      if (current_A[j] < X) {
        is_learned_well = false;
        break;
      }
    }
    if (is_learned_well) {
      ans = min(ans, current_C);
    }
  }

  // output
  WRITE_N(ans != INF ? ans : -1);

  return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>

char grid[55][55];
int grid2[55][55];

int main() {

	int H,W;

	scanf("%d %d",&H,&W);

	int i,j,k;

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
		scanf(" %c",&grid[i][j]);
		}
	}

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

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(grid[i][j]=='#'){
			grid2[i][j]=1;
			for(k=0;k<4;k++){
				if(0<=i+dy[k]&&i+dy[k]<H&&0<=j+dx[k]&&j+dx[k]<W){
					if(grid[i+dy[k]][j+dx[k]]=='#'){
					grid2[i+dy[k]][j+dx[k]]=1;
					break;
					}
				}
			}
			if(k==4){
			printf("No\n");
			return 0;
			}
			}
		}
	}

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if((grid[i][j]=='.'&&grid2[i][j]==0) ||(grid[i][j]=='#'&&grid2[i][j]==1));
			else{printf("No\n");return 0;}
		}
	}

	printf("Yes\n");

return 0;
}

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

int main(){
  int n;
  cin >> n;
  if(n<2) cout << 1 << endl;
  else if(n<4) cout << 2 << endl;
  else if(n<8) cout << 4 << endl;
  else if(n<16) cout << 8 << endl;
  else if(n<32) cout << 16 << endl;
  else if(n<64) cout << 32 << endl;
  else cout << 64 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	string N;
	int sum=0;
	cin>>N;
	for(int i=0 ;i<N.size();i++)
	{	
	    sum+=(N[i]-'0')%9;
      sum=sum%9;
	}
	if (!sum%9) cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 3380
import java.io.*;
import java.util.Scanner;

public class Main{

	static int n;
	public static void main(String args[])throws Exception{
		Scanner sc=new Scanner(System.in);
			 n= sc.nextInt();
			 int rem;
			 int flag=0;
			 while(n>0){
			 	rem=n%10;
			 	if(rem==7)
			 		flag=1;
			 	n=n/10;
			 }
			if(flag==1)
				System.out.print("Yes");
			else
				System.out.print("No");
		}
	}



Measured memory_bytes: 35760
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int a[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
             1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  cin >> k;

  cout << a[k-1] << ln;
  return 0;
}

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

int main(){
    int n;
    string s,ans;
    cin>>n>>s;
    string alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for (int i=0;i<s.length();i++) {
        ans+=alp[(alp.find(s[i])+n)%26];
    }
    cout<<ans;
}

Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int n;
    cin >> n;
    int ans=0;
    ans+=800*n;
    ans-=200*(n/15);
    cout << ans << endl;
}


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

namespace AtCoderCs
{
    class Program
    {
        static void Main()
        {

            int[] Array = { 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 };
            Console.WriteLine(Array[int.Parse(Console.ReadLine()) - 1]);
        }


    }
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, re = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    for(int i = 0; i < n; ++i){
        if((i + 1) != a[i]) re++;
    }
    if(re == 2 || re == 0) cout << "YES";
    else cout << "NO";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll K;
  cin >> K; 
  vector<ll> nums = {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};
  cout << nums[K-1] << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;
 
int main(){
    int N,K,happy,c2=0;cin>>N>>K;
    string S;cin>>S;
    for(int i=1;i<N;i++)
        if(S[i]=='L'&&S[i-1]=='R')c2++;
    if(c2>K){
        happy=N-2*(c2-K);
        if(S[0]=='L')happy--;
        if(S[N-1]=='R')happy--;
    }
    if(c2<K)
        happy=N-1;
    if(c2==K){
        if(S[0]=='L'&&S[N-1]=='R')
            happy=N-2;
        else happy=N-1;
    }
    
    cout<<happy<<endl;
    
    return 0;
}

Measured memory_bytes: 512
import java.util.*

fun main(args: Array<String>) {
    val xs = readLine()!!.split(' ')
    val stack: Deque<Int> = ArrayDeque()

    for (x in xs) {
        when(x) {
            "+" -> stack.push(stack.pop() + stack.pop())
            "-" -> stack.push(-stack.pop() + stack.pop())
            "*" -> stack.push(stack.pop() * stack.pop())
            else -> stack.push(x.toInt())
        }
    }

    println(stack.pop())
}


Measured memory_bytes: 33860
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...)
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	lint a;
	map<lint, int> mp;
	for (int i = 0; i < N; i++) {
		cin >> a;
		mp[a]++;
	}

	vector<lint> rec;
	for (const auto &e : mp) if (e.second >= 2) rec.emplace_back(e.first);

	int sz = (int)rec.size();
	if (sz == 0 || sz == 1 && mp[rec[0]] < 4) cout << "0\n";
	else if (sz == 1 && mp[rec[0]] >= 4) cout << rec[0] * rec[0] << "\n";
	else {
		sort(rec.begin(), rec.end());
		if (mp[rec[sz - 1]] >= 4) cout << rec[sz-1] * rec[sz-1] << "\n";
		else cout << rec[sz - 1] * rec[sz - 2] << "\n";
	}

	return 0;
}

Measured memory_bytes: 6528
if __name__ == '__main__':
    n=int(input())
    a=[]
    b=[int(x) for x in input().split()]
    a.append(b[0])
    for i in range(n-2):
        a.append(min([b[i],b[i+1]]))
    a.append(b[-1])
    print(sum(a))
  

Measured memory_bytes: 3060
<?php
$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

$L = $s[0];
$R = $s[1];
$R = min($L + 2019, $R);

$min = 2019;
for ($i = $L; $i <= $R; $i++) {
    for ($j = $i + 1; $j <= $R; $j++) {
        $mod = ($i * $j) % 2019;
        $min = min($min, $mod);
    }
}

echo $min;

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

namespace ABC139_C {
    class Program {
        static int N { get; }
        static IReadOnlyList<int> H { get; }

        static Program() {
            N = Convert.ToInt32(Console.ReadLine());
            H = Console.ReadLine().Split().Select(f => Convert.ToInt32(f)).ToList();
        }

        static void Main(string[] args) {
            Console.WriteLine(GetAnsMember().Max().ToString());
        }

        static IEnumerable<int> GetAnsMember() {
            var total = 0;
            foreach (var i in Enumerable.Range(0, N)) {
                if (i == N - 1 || H[i] < H[i + 1] ) {
                    yield return total;
                    total = 0;
                    continue;
                }
                total++;
            }
        }
    }
}


Measured memory_bytes: 25948
// Author : Syed Mujtaba
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
#define mod              //1000000007  //998244353// 1e9 + 7
#define inf             1000000007 // 1e9 + 7
#define MAX             10000007   // 1e7 + 7
#define MAXN 			10000004
#define mt 				make_tuple
#define eps             1e-6
#define endl			'\n'
#define test            int t; cin>>t; while(t--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define tree            tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update>
// int fact[1000007]={0};
// int spf[(int)(1e7) + 20];
// bool prime[(int)((1e7) + 20)];
// int gcd(int a,int b){if(b==0)return a; return gcd(b,a%b);}
// void sp(int n){spf[1]=1;for(int i=2;i<n;i++)spf[i]=i;for(int i=4;i<n;i+=2)spf[i]=2;for(int i=3;i*i<n;i++){if(spf[i]==i){for(int j=i*i;j<n;j+=i)if(spf[j]==j)spf[j]=i;}}}
// void sieve(int n){memset(prime,true,sizeof(prime) );for(int p=2;p*p<=n;p++){if(prime[p]==true)for(int i=p*p;i<=n;i+=p)prime[i]=false;}prime[0]=false;prime[1]=false;}
// int xyp(int x,int y){int res=1;while(y>0){if(y%2==1) res=(res*x)%mod;x=(x*x)%mod;y/=2;}return res%mod;}
// int inv(int x){return xyp(x,mod - 2);}
// void init() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
// int ncr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[r],mod-2)))%mod; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res;}
// int npr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res; }
// bool isp(int a){if(a == 2)return true;if(a == 1)return false;for(int x= 2; x <= sqrt(a) + 1; x++)if(a % x == 0)return false;return true;}
// int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
// int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
// int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
// #define p_set tree< pair<int,int> ,  null_type ,  less<pair<int,int>> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// #define i_set tree< int ,  null_type ,  less< int > ,  rb_tree_tag ,  tree_order_statistics_node_update>
// freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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


signed main()
{
	fast_io
	// test
	{
		string s;
		cin >> s;
		if(s[2] == s[3] && s[4] == s[5])
			cout << "Yes\n";
		else cout << "No\n";
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
string s;
int a[200010] = {},b[200010];
int main(){
	int i,n;
	cin >> n >> s;
	for(i=1;i<=n;i++){
		a[i] = a[i-1];
		if(s[i-1]=='#'){
			a[i]++;
		}
	}
	b[n + 1] = 0;
	for(i=n;i>=1;i--){
		b[i] = b[i+1];
		if(s[i-1]=='.'){
			b[i]++;
		}
	}
	int ans = 3000000;
	for(i=0;i<=n;i++){
		ans = min(ans,a[i] + b[i+1]);
	}
	cout << ans << endl;
}
	

Measured memory_bytes: 2180
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n,d;
  cin>>n>>d;
  int a[n][d];
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin>>a[i][j];
    }
  }
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      long long dist=0;
      for(int k=0;k<d;k++){
        dist+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
      }
      int i=1;
      while(i*i<=dist){
        if(i*i==dist){
          ++ans;
          break;
        }
        ++i;
      }
    }
  }
  cout<<ans;
}

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

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};




int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll x,y;
  cin>>x>>y;
  if(2*x<=y &&y<=4*x && y%2==0){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
}

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

void solve(int n)
{
  string s="Christmas";
  cout<<s;
  for(short i=25-n;i>0;i--)
  {
    cout<<" Eve";
  }
}

int main()
{
  short n;
  cin>>n;
  void (*ptr)(int);
  ptr=&solve;
  (*ptr)(n);
  return 0;
}

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

int N;
double X[9], Y[9];

int factrial(int N)
{
	return ( N <= 1 ? 1 : N * factrial(N - 1) );
}

double dfs(int v, int bit, int depth = 0)
{
	double ret = 0.0;
	if ( depth == N ) return ( 0.0 );

	for ( int i = 0; i < N; i++ ) {
		if ( ((bit >> i) & 1) == 0 ) {
			ret += dfs(i, bit | (1 << i), depth + 1);
			if ( v >= 0 ) ret += factrial(N - depth - 1) * sqrt(pow(X[v] - X[i], 2) + pow(Y[v] - Y[i], 2));
		}
	}

	return ( ret );
}

int main()
{
	cin >> N;
	for ( int i = 0; i < N; i++ ) cin >> X[i] >> Y[i];
		
	printf("%.10f\n", dfs(-1, 0) / factrial(N));

	return ( 0 );
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define F first
#define S second

int ans=0,used[10];
void dfs(int n,int s){
  if(s<0)return;
  if(n==0 && s==0){
    ++ans;
    return;
  }
  for(int i=0;i<=9;i++){
    if(used[i])continue;
    used[i]=true;
    dfs(n-1,s-n*i);
    used[i]=false;
  }
}
  
int memo[11][331];

main(){
  rep(i,10)used[i]=i;
  int p=0;
  do{
    ++p;
    int sum=0;
    rep(i,10){
      sum+=used[i]*(i+1);
      memo[i+1][sum]++;
    }
  }while(next_permutation(used,used+10));

  int n,s;
  while(~scanf("%d%d",&n,&s)){
    int t=1,f=10-n;
    while(f)t*=f--;
    int ans;
    if(s>=331)ans=0;
    else ans=memo[n][s]/t;
    printf("%d\n",ans);
  }

}

Measured memory_bytes: 764