akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            long n = Input();
            long[] a = Input3();
            long[] order = new long[n ];

            for(long i = 0; i < n; i++)
            {
                order[a[i]-1] = i+1;
            }

            Console.WriteLine(string.Join(" ",order));


        }

       
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }

        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }
    }
}


Measured memory_bytes: 29276
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MOD 1000000007
#define MX 105

int n,m;
char s[MX];
int al[26];

int del(int x)
{
    for (int i=0;i<26;i++)
        if (al[i]>=x)
        {
            al[i]-=x;
            return 1;
        }
    return 0;
}

int dfs(int s)
{
    if (s<=1)
    {
        if (s==0)
        {
            if (m%2==1)
            {
                for (int i=0;i<n/2;i++)
                    if (del(2)==0) return 0;
            }
            return 1;
        }
        for (int i=0;i<m/2;i++)
            if (del(2)==0) return 0;
        if (m%2==1)
        {
            for (int i=0;i<n/2;i++)
                if (del(2)==0) return 0;
        }
        return 1;
    }
    for (int i=0;i<m/2;i++)
        if (del(4)==0) return 0;
    if (dfs(s-2))
        return 1;
    return 0;
}

int main()
{
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++)
    {
        scanf("%s",s);
        for (int j=0;j<m;j++)
            al[ s[j]-'a' ]++;
    }

    if (dfs(n))
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


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

namespace ABC173A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            while (N > 1000)
            {
                N -= 1000;
            }
            Console.WriteLine(1000-N);
        }
    }
}


Measured memory_bytes: 27532
#include <bits/stdc++.h>
using namespace std;
vector<vector<set<long long>>> AA;
void f(int s, int t, int m, long long p, set<long long>& a) {
	if (s == t) {
		a.insert(p);
		return;
	}
	for (int i = 1; i <= m; ++ i) {
		if (s % i != s) {
			f(s % i, t, i, p | (1LL<<i), a);
		}
	}
}
int main() {
	AA = vector<vector<set<long long>>>(51, vector<set<long long>>(51));
	for (int i = 0; i <= 50; ++ i) {
		for (int j = 0; j <= 50; ++ j) {
			f(i, j, 50, 0, AA[i][j]);
		}
	}

	int N;
	cin >> N;
	vector<int> A(N), B(N);
	for (auto& x : A) cin >> x;
	for (auto& x : B) cin >> x;

	vector<set<long long>> a(N);
	for (int i = 0; i < N; ++ i) {
		a[i] = AA[A[i]][B[i]];
		if (a[i].empty()) {
			cout << -1 << endl;
			return 0;
		}
	}
	long long r = 0;
	for (;;) {
		long long m = 0;
		for (int i = 0; i < N; ++ i) {
			m = max(m, *a[i].begin());
		}
		if (m == 0) break;
		long long t = 0;
		for (int i = 50; i >= 0; -- i) if (m&(1LL<<i)) {
			t = i;
			break;
		}
		r |= 1LL << t;
		//cerr << t << endl;
		for (int i = 0; i < N; ++ i) {
			set<long long> b;
			for (auto x : a[i]) {
				if (x >> (t+1)) continue;
				b.insert(x & ((1LL<<t)-1));
			}
			a[i].swap(b);
		}
	}
	cout << r << endl;
}


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  int cnt = 1;
  ll suma = A[0];
  for (int i = 1; i < N; i++) {
    if (2 * suma >= A[i])
      cnt++;
    else
      cnt = 1;
    suma += A[i];
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int x, y;
int main() {
	cin >> x >> y;
	if (abs(x) < abs(y)) cout << (x < 0 ? 1 : 0) + (y < 0 ? 1 : 0) + abs(y) - abs(x) << endl;
	else if (abs(x) == abs(y)) cout << (x != y ? 1 : 0) << endl;
	else cout << (x > 0 ? 1 : 0) + (y > 0 ? 1 : 0) + abs(x) - abs(y) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    using ll = long long;
    ll n, h;
    cin >> n >> h;
    using P = pair<ll, ll>;
    vector<P> s(n);
    ll cu = 0;
    for(int i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        s[i].first = b;
        s[i].second = a;
        cu = max(cu, a);
    }
    sort(s.begin(), s.end(), greater<P>());
   
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        if(cu <= s[i].first)
        {
            h -= s[i].first;
            ans++;
        }
        else
        {
            break;
        }
        if(h <= 0)
        {
            cout << ans << endl;
            return 0;
        }
    }
    while(true)
    {
        if(h <= cu)
        {
            ans++;
            cout << ans << endl;
            return 0;
        }
        else
        {
            h -= cu;
            ans++;
        }
    }
}



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

int main(){
  int N;
  cin>>N;
  int num,a,b,c;
  a=b=c=0;
  for(int i=0;i<N;i++){
    cin>>num;
    num%=4;
    if(num==0) a++;
    else if(num==2) b++;
    else c++;
  }
  if(b>=2&&a>=(N-b+1)/2) cout<<"Yes"<<endl;
  else if(a>=N/2) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define ll long long
#define re return
#define mp map<int,int>
#define N 200005
#define pql priority_queue<ll>
#define all(v) (v).begin(),(v).end()
using namespace std;
int n,a[N];
string l,r;
int main() {
	cin>>r>>n;
	rep(i,1,n){
		int a;
		cin>>a;
		if(a==1) swap(l,r);
		else {
			int b; char c;
			cin>>b>>c;
			if(b==1)l+=c;
			if(b==2)r+=c;
		}
	}
	reverse(all(l));
	l+=r;
	cout<<l;
	re 0;
}

Measured memory_bytes: 1128
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>

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

using namespace std;
typedef long long ll;

int H,W;
char S[21][21];
int A[21][21]={};
int Done[21][21]={};
pair<int,int> sp;
pair<int,int> gp;

vector<int> x={0,0,-1,1};
vector<int> y={1,-1,0,0};

int bfs(){
  if(S[sp.first][sp.second] == '#' || S[gp.first][gp.second] == '#')
    return 0;
  
  queue<pair<int,int> > qp;
  qp.push(sp);
  while(!qp.empty()){
    pair<int,int> now = qp.front();
    qp.pop();
    if(now == gp) return A[now.first][now.second];
    if(Done[now.first][now.second]) continue;
    Done[now.first][now.second]=1;
    rep(i,4){
      int nx = now.first + x[i];
      int ny = now.second + y[i];
      if(0<=nx && nx<=H-1 && 0<=ny && ny<=W-1 && S[nx][ny]=='.'){
	A[nx][ny]=A[now.first][now.second]+1;
	qp.push(make_pair(nx,ny));
      }
    }
  }
  return 0;
}

int main(){
  cin >> H >> W;
  rep(i,H) rep(j,W) cin >> S[i][j];

  int ans=0;
  rep(i,H) rep(j,W){
    rep(k,H) rep(l,W){
      sp=make_pair(i,j);
      gp=make_pair(k,l);
      memset(A,0,sizeof(A));
      memset(Done,0,sizeof(Done));      
      ans = max(ans, bfs());
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

class UnionFind {
private:
  vector<ll> parent;
  vector<ll> rank;

public:
  vector<ll> sz;
  UnionFind(ll size) : parent(size), rank(size, 0), sz(size, 1) {
    for (ll i = 0; i < size; i++) {
      parent[i] = i;
    }
  }

  ll find(ll x) {
    if (parent[x] == x) {
      return x;
    } else {
      return parent[x] = find(parent[x]);
    }
  }

  void unite(ll x, ll y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rank[x] < rank[y]) {
      parent[x] = y;
      sz[y] += sz[x];
    } else {
      parent[y] = x;
      sz[x] += sz[y];
      if (rank[x] == rank[y]) rank[x]++;
    }
  }

  bool same(ll x, ll y) {
    return find(x) == find(y);
  }
};

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

  ll n, m, k;
  cin >> n >> m >> k;
  vl a(m), b(m), c(k), d(k);
  vector<vl> block(n), tomo(n);

  UnionFind uf(n);

  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    tomo[a[i]].push_back(b[i]);
    tomo[b[i]].push_back(a[i]);
    uf.unite(a[i], b[i]);
  }

  rep(i, k) {
    cin >> c[i] >> d[i];
    c[i]--;
    d[i]--;
  }

  using pll = pair<ll, ll>;
  vector<vector<pll>> edge(n);
  rep(i, m) {
    if (uf.same(a[i], b[i])) {
      edge[uf.find(a[i])].emplace_back(a[i], b[i]);
    }
  }
  rep(i, k) {
    if (uf.same(c[i], d[i])) {
      edge[uf.find(c[i])].emplace_back(c[i], d[i]);
    }
  }

  vl ans(n);
  rep(i, n) {
    ans[i] = uf.sz[uf.find(i)]-1;
  }

  rep(i, n) {
    for (auto&& j : edge[i]) {
      ans[j.first]--;
      ans[j.second]--;
    }
  }

  rep(i, n) {
    cout << ans[i];
    if (i == n-1) cout << endl;
    else cout << " ";
  }
}


Measured memory_bytes: 22896
#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-7
#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(){
	ll A,B,C;
	scan(A>>B>>C);
	prin(min({A*B*(C%2),B*C*(A%2),C*A*(B%2)}));
	return 0;
}


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

int main() {
    int x, y;
    while( true ) {
        cin >> x >> y;
        if( x == 0 && y == 0 ) break;
        switch( x > y ) {
            case 0: cout << x << " " << y << endl; break;
            case 1: cout << y << " " << x << endl; break;
        }
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstring>
#include<cstdio>
#define N (1000+100)
#define MOD (1000000007)
using namespace std;

long long n=2,H,W,K,a[N][N],S,A,B;
char st[N];

struct Matrix
{
	long long m[11][11];
	void clear(){memset(m,0,sizeof(m));}
}V,G;
Matrix operator * (Matrix a,Matrix b)
{
	Matrix ans; ans.clear();
	for (int i=1; i<=n; ++i)
		for (int j=1; j<=n; ++j)
			for (int k=1; k<=n; ++k)
				(ans.m[i][j]+=a.m[i][k]*b.m[k][j])%=MOD;
	return ans;
}

Matrix Mat_Qpow(Matrix a,long long p)
{
	Matrix ans; ans.clear();
	for (int i=1; i<=n; ++i) ans.m[i][i]=1;
	while (p)
	{
		if (p&1) ans=ans*a;
		a=a*a; p>>=1;
	}
	return ans;
}

long long Qpow(long long a,long long p)
{
	long long ans=1,base=a;
	while (p)
	{
		if (p&1) ans=ans*base%MOD;
		base=base*base%MOD; p>>=1;
	}
	return ans;
}

int Get()
{
	int ansLR=0,ansUD=0;//左右,上下接口的个数
	int anslr=0,ansud=0;//左右，上下相邻为黑色的位置个数 
	for (int i=1; i<=H-1; ++i)
		for (int j=1; j<=W; ++j)
			ansud+=(a[i][j]==a[i+1][j] && a[i][j]==1);
	for (int i=1; i<=H; ++i)
		for (int j=1; j<=W-1; ++j)
			anslr+=(a[i][j]==a[i][j+1] && a[i][j]==1);
	 
	for (int i=1; i<=H; ++i)
		ansLR+=(a[i][1]==a[i][W] && a[i][1]==1);
	for (int i=1; i<=W; ++i)
		ansUD+=(a[1][i]==a[H][i] && a[1][i]==1);
		
	if (ansLR && ansUD) return 2;
	if (!ansLR && !ansUD) return 0;
	if (ansLR) A=anslr,B=ansLR;
	else A=ansud,B=ansUD;
	return 1;
}

void Solve()
{
	G.m[1][1]=A; G.m[1][2]=B;
	V.m[1][1]=S; V.m[1][2]=0; V.m[2][1]=A; V.m[2][2]=B;
	V=Mat_Qpow(V,K-2); G=G*V;
	long long ans=Qpow(S,K-1)-G.m[1][1];
	printf("%lld",ans<=0?ans+MOD:ans);
}

int main()
{
	scanf("%lld%lld%lld",&H,&W,&K);
	for (int i=1; i<=H; ++i)
	{
		scanf("%s",st);
		for (int j=1; j<=W; ++j)
			a[i][j]=st[j-1]=='#'?1:0,S+=a[i][j];
	}
	if (K<=1) {printf("1"); return 0;}
	
	int g=Get();
	if (g==0) {printf("%lld",Qpow(S,K-1)); return 0;}
	if (g==2) {printf("1"); return 0;}
	
	Solve();
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
struct P{int x,y;P(int x=0,int y=0):x(x),y(y){}friend bool operator<(P a,P b){return a.x<b.x;}}p[1200005];
int w,h,n,mx[2500005],lz[2500005],s1[1200005],s2[1200005],ans,t1,t2;
void down(int x){mx[x*2]+=lz[x];mx[x*2+1]+=lz[x];lz[x*2]+=lz[x];lz[x*2+1]+=lz[x];lz[x]=0;}
void upd(int x,int l,int r,int b,int e,int v)
{
	down(x);if(b<=l&&r<=e){lz[x]+=v;mx[x]+=v;return;}
	int mid=(l+r)>>1;if(b<=mid) upd(x*2,l,mid,b,e,v);if(e>mid) upd(x*2+1,mid+1,r,b,e,v);
	mx[x]=max(mx[x*2],mx[x*2+1]);
}
void gao()
{
	sort(p+1,p+n+1);memset(mx,0,sizeof(mx));memset(lz,0,sizeof(lz));t1=t2=0;
	s1[t1]=s2[t2]=1;upd(1,1,n,1,n,h);
	for(int i=2;i<=n;i++)
	{
		upd(1,1,n,1,i-1,p[i].x-p[i-1].x);ans=max(ans,mx[1]*2);
		if(p[i].y>=h/2)
		{
			upd(1,1,n,s1[t1],i-1,p[i].y-h);
			while(t1&&p[s1[t1]].y>=p[i].y) upd(1,1,n,s1[t1-1],s1[t1]-1,p[i].y-p[s1[t1]].y),t1--;
			s1[++t1]=i;
		}
		else
		{
			upd(1,1,n,s2[t2],i-1,-p[i].y);
			while(t2&&p[s2[t2]].y<=p[i].y) upd(1,1,n,s2[t2-1],s2[t2]-1,p[s2[t2]].y-p[i].y),t2--;
			s2[++t2]=i;
		}
	}
}
int main()
{
	scanf("%d%d%d",&w,&h,&n);n++;p[1]=P(0,0);n++;p[n]=P(w,h);ans=2*max(w,h)+2;
	for(int i=2;i<n;i++) scanf("%d%d",&p[i].x,&p[i].y);
	gao();for(int i=1;i<=n;i++) swap(p[i].x,p[i].y);swap(w,h);gao();
	printf("%d\n",ans);
}

Measured memory_bytes: 32768
N = int(input())
L = list(map(int, input().split()))

L.sort()
ans = 0

for i in range(len(L)-2):
    for j in range(i+1, len(L)-1):
        if L[j] == L[i]: continue
        for k in range(j+1, len(L)):
            if L[k] == L[j]: continue
            if L[i] + L[j] > L[k]:
                ans += 1

print(ans)


Measured memory_bytes: 80040
#include<stdio.h>
int main(){
	int a[5],i,n=0;
	for(i=0;i<5;i++){
		scanf("%d",&a[i]);
		if(a[i]<40)a[i]=40;
		n=n+a[i];
	}
	printf("%d\n",n/5);
	return 0;
}


Measured memory_bytes: 2088
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A;
  int i = 0;
  cin >> N >> A;
  
  if(N % 500 <= A){
  	cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long L, R, D; cin >> L >> R >> D;
	long long nas = 0;
	for (long long i = L; i <= R; i++) {
		if (i % D == 0) nas++;
	}
	cout << nas << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(){
    char s[11],out[11];
    int i,j=0;
    scanf("%s",s);

    for(i=0;s[i]!='\0';i++){
        if(s[i]!='B')out[j]=s[i];
        if(s[i]=='B'){if(j==0){j--;}else{j-=2;}}
        j++;
    }
    out[j]='\0';

    printf("%s",out);

    return 0;
}

Measured memory_bytes: 128
#include<cmath>
#include<cstring>
#include<iostream>
using namespace std;
int main(){
	long i,n,a[10005],b[10005],maxn=-213,sum=0;
	cin>>n;
	for(i=0;i<n;i++)cin>>a[i];
	for(i=0;i<n;i++){
		if(a[i]==a[i+1]&&a[i+1]==a[i+2]){
			a[i+1]=0;
			sum++;
		}
		if(a[i]==a[i+1]&&a[i+1]!=a[i+2]){
			a[i]=0;
			sum++;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int m,d,d1,d2,ans=0;
    cin>>m>>d;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=d;j++){
            d1=j%10,d2=j/10;
            ans+=(d1>1&&d2>1&&d1*d2==i);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589;

int a[100000];
bool flag = true;
ll n, p;
ll ans = 0;
int main(){
  int N;
  cin >> N;
  if(N % 2 == 0){
    int tmp;
    rep(i, N){
      cin >> tmp;
      if(tmp %2 == 0){
        flag = false;
        break;
      }
      tmp /= 2;
      a[tmp]++;
      if(a[tmp] > 2){
        flag = false;
        break;
      }
    }
    if(flag){
      ans = 1;
      n = N/2;
      p = 2;
      while(n > 0){
        if(n & 1) ans = ans * p % MOD;
        p = p * p % MOD;
        n >>= 1;
        //cout << ans <<endl;
      }
    } 
  }else{
    int tmp;
    rep(i, N){
      cin >> tmp;
      if(tmp %2 == 1){
        flag = false;
        break;
      }
      tmp /= 2;
      a[tmp]++;
      if(a[0] > 1){
        flag = false;
        break;
      }else if(a[tmp] > 2){
        flag = false;
        break;
      }
    }
    if(flag){
      ans++;
      n = N/2;
      p = 2;
      while(n > 0){
        if(n & 1) ans = ans * p % MOD;
        p = p * p % MOD;
        n >>= 1;
        //cout << ans <<endl;
      }
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 384
# C - Repsept
def main():
    k = int(input())
    cnt = 7
    
    for i in range(1, k+1):
        if cnt%k == 0:
            print(i)
            exit()
        cnt = (10*cnt+7) % k
    else:
        print(-1)

if __name__ ==  "__main__":
    main()

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x) ((x) * (x))
#define bit(n) (1LL<<(n))
#define pcnt(x) __builtin_popcountll(x)
#define PB push_back
#define MP make_pair
#define endl "\n"
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 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 main() {
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k; cin >> k;
  cout << a[k-1] << endl;
    

}


Measured memory_bytes: 256
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>

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

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;

const int INF = INT_MAX;

int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int N;
    cin >> N;
    ll A[2*112345];
    repeat(i, N){
        cin >> A[i];
    }
    A[N] = 0;
    int r = 0;
    ll sum = A[0],x = A[0];
    ll ans = 0;
    repeat(l, N){
        while(r < N && sum == x){
            r++;
            sum += A[r];
            x ^= A[r];
        }
        ans += r-l;
        sum -= A[l];
        x ^= A[l];
        //cout << l << " " << r << endl;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1792
//struct cmp {bool operator()(const pair<int, char> &a, const pair<int, char> &b) {if (a.first == b.first) {return a.second > b.second;} else {return a.first > b.first;}}};
#include<bits/stdc++.h>
#define endl "\n"
#define _  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define ll long long
//#define int long long
#define MOD 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 2e5 + 5;
const ll inf = LLONG_MAX;
using namespace std;

template<typename T> void debug(string s, T x) {cout << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cout << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}
template<class T>
void print_container(T &container) {for (auto &t : container) {cout << t << " ";} cout << endl;}
//Pain is temporary Glory is forever!!
//Think quick,Code Fast!!
int a, b;
void solve() {
	cin >> a >> b;


	if (b % 2 == 0 && b >= 2 * a && b <= 4 * a) {
		cout << "Yes";
	} else {
		cout << "No";
	}

	// int y = b - 2 * a;
	// y /= 2;
	// int x = a - y;
	// if (y >= 1 && x >= 1 ) {
	// 	cout << "Yes\n";
	// } else {
	// 	cout << "No\n";
	// }
}

int32_t main() {
	_


	solve();
}





Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define endl '\n'
#define ALL(V) V.begin(),V.end()
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;

struct UnionFind {
    ll N, max_size;
    V<ll> rank, parent, tsize;

    UnionFind(ll N) : N(N), max_size(1), rank(N, 1), tsize(N, 1) {
        parent = V<ll>(N);
        iota(ALL(parent), 0ll);
    }

    ~UnionFind() {}

    ll find(ll x) {
        if(parent[x] == x) return x;
        else return parent[x] = find(parent[x]);
    }

    void unit(ll x, ll y) {
        ll px = find(x);
        ll py = find(y);
        if(px == py) return;
        if(rank[px] < rank[py]) swap(px, py);

        parent[py] = px;
        tsize[px] += tsize[py];
        max_size = max(max_size, tsize[px]);
        rank[px] += rank[py];
    }

    bool same(ll x, ll y) { return find(x) == find(y); }
};

using PLL = pair<ll, ll>;
using TLL = tuple<ll, ll, ll>;

bool solve() {
    ll N, M;
    cin >> N >> M;
    if(!(N + M)) return false;

    V<ll> H(N);

    for(ll &e : H) cin >> e;
    V<TLL> edges;
    for(ll i = 0; i < M; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        edges.emplace_back(c, a - 1, b - 1);
    }

    VV<ll> h_lis;
    {
        map<ll, V<ll>> hmap;
        for(ll i = 0; i < N; i++) hmap[H[i]].push_back(i);
        while(hmap.size()) {
            auto ite = hmap.begin();
            h_lis.push_back(ite->second);
            hmap.erase(ite);
        }
    }
    
    sort(ALL(edges));

    ll upper = h_lis.size();
    V<bool> used(N, true);
    {
        ll sum = N;
        for(ll i = 0; i < h_lis.size(); i++) {
            const auto &v = h_lis[i];
            UnionFind uf(N);
            for(const auto ele : edges) {
                ll a, b, c;
                tie(c, a, b) = ele;
                if(used[a] && used[b]) uf.unit(a, b);
            }
            if(uf.max_size < sum) {
                upper = i;
                break;
            }
            for(ll n : v) used[n] = false;
            sum -= v.size();
        }
    }

    ll ans = 0;

    {
        UnionFind uf(N);
        for(ll i = upper - 1; i >= 0; i--) {
            for(ll ni : h_lis[i]) used[ni] = true;
            for(const auto ele : edges) {
                ll a, b, c;
                tie(c, a, b) = ele;
                if(!used[a] || !used[b]) continue;
                if(uf.same(a, b)) continue;
                ans += c;
                uf.unit(a, b);
            }
        }
    }

    cout << ans << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}



Measured memory_bytes: 4208
#include <iostream>
#include <stdlib.h>

using namespace std;

class stack
{
public:
	void input();
	int pop();
	void push(int x);
	int plus(char* x, char* y);
	int multiply(char* x, char* y);
	void print();
private:
	int s[1000];
	int top;
};
void stack::input()
{
	int a, b;
	char d[100];
	top = 1;
	while(scanf("%s", d) != EOF)
	{
		if(d[0] == '+')
		{
			a = pop();
			b = pop();
			push(a+b);
		} else if(d[0] == '*')
		{
			a = pop();
			b = pop();
			push(a*b);

		} else if(d[0] == '-')
		{
			b = pop();
			a = pop();
			push(a-b);
		} else
		{
			push(atoi(d));
		}
	}
}
int stack::pop()
{
	return s[--top];
}
void stack::push(int x)
{
	s[top++] = x;
}
void stack::print()
{
	cout << pop() << endl;
}

int main()
{
	stack stack;
	stack.input();
	stack.print();
	return 0;
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N;
  cin >> N;
  vector<pair<i64, i64>> ans;
  i64 ng = N;
  if (N % 2 == 1)
    ng--;
  for (i64 i = 1; i <= N; i++)
  {
    for (i64 j = 1; j <= N; j++)
    {
      if (j <= i || j == ng)
        continue;
      ans.push_back({i, j});
    }
    ng--;
  }
  cout << ans.size() << endl;
  for (pair<i64, i64> i : ans)
    cout << i.first << " " << i.second << endl;
  return 0;
}


Measured memory_bytes: 512
N = int(input())

L = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

ans = []
def f(List, n):
    if n == N:
        s = ""
        for l in List:
            s += L[l]
        ans.append(s)
        return None
    for i in range(max(List)+2):
        f(List+[i], n+1)

f([0], 1)        
ans.sort()
for a in ans:
    print(a)

Measured memory_bytes: 12656
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
ans='No'
 
for i in range(N-M+1):
    for j in range(N-M+1):
        cnt=0
        if A[i][j:j+M] ==B[0]:
            for k in range(1,M):
                if A[i+k][j:j+M] == B[k]:
                    cnt+=1
            if cnt==M-1:
                ans='Yes'
                
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();

        ModInt answer = ModInt.Pow(10, n) - ModInt.Pow(9, n) - ModInt.Pow(9, n) + ModInt.Pow(8, n);

        Console.WriteLine(answer);
    }

    // ModInt
    class ModInt
    {
        public const long Mod = (int)1e9 + 7;

        public long num;

        public ModInt(long n) { num = n; }

        public override string ToString() { return num.ToString(); }
        public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
        public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
        public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
        public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

        public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

        public static ModInt Pow(long v, long k)
        {
            long ret = 1;
            for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
                if ((k & 1) == 1) ret = ret * v % Mod;
            return new ModInt(ret);
        }

        public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27512
#include <iostream>
#include <vector>
#include <algorithm>

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

using namespace std;

int x, y;

int main(){
    cin >> x >> y;
    cout << (x % y == 0 ? -1 : x) << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

var scanner *bufio.Scanner

func printIt() {
	for {
		h := nextInt()
		w := nextInt()
		if h == 0 && w == 0 {
			break
		}
		for i := 0; i < h; i++ {
			fmt.Println(strings.Repeat("#", w))
		}
		fmt.Println()
	}

}

func nextInt() int {
	scanner.Scan()
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(1)
	}
	return num
}

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	printIt()
}



Measured memory_bytes: 1224
n, m = input().split(' ')
n = int(n)
m = int(m)
dp = [float('inf')]*(2**n)
dp[0] = 0
for i in range(m):
    a, b = input().split(' ')
    a = int(a)
    b = int(b)
    M = 0
    for j in input().split(' '):
        M += 2**(int(j)-1)

    for j in range(2**n):
        # dp[j|M] = min(dp[j]+a, dp[j|M])
        # dp[j|M] = dp[j] + a if dp[j] + a < dp[j|M] else dp[j|M]
        if dp[j] + a < dp[j|M]:
            dp[j|M] = dp[j] + a


print(dp[2**n-1] if dp[2**n-1] < float('inf') else -1)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;
typedef pair<int, string> pis;

int main(){
	map<int, string> base_table;
	const int SPEC_C  = 0x0001;
	const int SPEC_Cs = 0x0002;
	const int SPEC_D  = 0x0004;
	const int SPEC_Ds = 0x0008;
	const int SPEC_E  = 0x0010;
	const int SPEC_F  = 0x0020;
	const int SPEC_Fs = 0x0040;
	const int SPEC_G  = 0x0080;
	const int SPEC_Gs = 0x0100;
	const int SPEC_A  = 0x0200;
	const int SPEC_As = 0x0400;
	const int SPEC_B  = 0x0800;
	base_table.insert(pis(SPEC_C | SPEC_E | SPEC_G, ""));
	base_table.insert(pis(SPEC_C | SPEC_E | SPEC_G | SPEC_As, "7"));
	base_table.insert(pis(SPEC_C | SPEC_E | SPEC_G | SPEC_B, "M7"));
	base_table.insert(pis(SPEC_C | SPEC_Ds | SPEC_G, "m"));
	base_table.insert(pis(SPEC_C | SPEC_Ds | SPEC_G | SPEC_As, "m7"));
	multimap<int, string> spec_table;
	for(
		map<int, string>::iterator it = base_table.begin();
		it != base_table.end(); ++it)
	{
#define SPEC_INSERT(NOTE, TEXT) { \
			if(!(it->first & (NOTE))){ \
				spec_table.insert( \
					pis(it->first | (NOTE), it->second + (TEXT))); \
			} \
		}
		SPEC_INSERT(0      , "");
		SPEC_INSERT(SPEC_Cs, "(-9)");
		SPEC_INSERT(SPEC_D , "(9)");
		SPEC_INSERT(SPEC_Ds, "(+9)");
		SPEC_INSERT(SPEC_E , "(-11)");
		SPEC_INSERT(SPEC_F , "(11)");
		SPEC_INSERT(SPEC_Fs, "(+11)");
		SPEC_INSERT(SPEC_Gs, "(-13)");
		SPEC_INSERT(SPEC_A , "(13)");
		SPEC_INSERT(SPEC_As, "(+13)");
		if(!(it->first & SPEC_Fs)){
			spec_table.insert(
				pis(it->first & ~SPEC_G | SPEC_Fs, it->second + "(-5)"));
		}
		if(!(it->first & SPEC_Gs)){
			spec_table.insert(
				pis(it->first & ~SPEC_G | SPEC_Gs, it->second + "(+5)"));
		}
	}
	map<string, int> note_table;
	note_table["C"]  = 0;
	note_table["C#"] = 1;
	note_table["D"]  = 2;
	note_table["D#"] = 3;
	note_table["E"]  = 4;
	note_table["F"]  = 5;
	note_table["F#"] = 6;
	note_table["G"]  = 7;
	note_table["G#"] = 8;
	note_table["A"]  = 9;
	note_table["A#"] = 10;
	note_table["B"]  = 11;
	const char *root_table[] = {
		"C", "C#", "D", "D#", "E", "F",
		"F#", "G", "G#", "A", "A#", "B"
	};

	int N;
	cin >> N;
	while(N--){
		int M;
		cin >> M;
		int chord = 0;
		while(M--){
			string s;
			cin >> s;
			chord |= 1 << note_table[s];
		}
		vector<string> answers;
		for(int i = 0; i < 12; ++i){
			if(chord & 1){
				map<int, string>::iterator it = spec_table.find(chord);
				while(it != spec_table.end() && it->first == chord){
					answers.push_back(root_table[i] + it->second);
					++it;
				}
			}
			chord = ((chord >> 1) | (chord << 11)) & 0x0fff;
		}
		if(answers.size() == 0){
			cout << "UNKNOWN" << endl;
		}else{
			for(int i = 0; i < answers.size(); ++i){
				cout << answers[i];
				if(i == answers.size() - 1){
					cout << endl;
				}else{
					cout << " ";
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

void opera(char str[128],  int score_a, int score_b);

int main(void)
{
	int A, B;
	int i;
	char str[128];
	
	
	while (1){
		for (i = 0; i < 3; i++){
			scanf("%s", str);
			if (str[0] == '0'){
				return (0);
			}
			A = 0;
			B = 0;
			
			opera(str, A, B);
			
		}
	}
	
}

void opera(char str[128], int score_a, int score_b)
{
	int i = 0;
	
	//printf("---%d %d----\n", *score_a, *score_b);
	
	
	while (str[i] != 0){
		i++;
		if (str[i] == 'A'){
			score_a += 1;
		}
		else if (str[i] == 'B'){
			score_b += 1;
		}
	}
	
	if (score_a == 10 && score_b <= 9){
		score_a += 1;
	}
	else if (score_b == 10 && score_b <= 9){
		score_b += 1;
	}
	else if (score_a - score_b == 1){
		score_a++;
	}
	else {
		score_b++;
	}
	
	printf("%d %d\n", score_a, score_b);
}

Measured memory_bytes: 536
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

int main() {
	int n;cin>>n;
	pii r[N],b[N];
	rep(i,n) cin>>r[i].first>>r[i].second;
	rep(i,n) cin>>b[i].first>>b[i].second;

	sort(b,b+n);
	bool f[N];
	rep(i,n) f[i]=false;
	rep(i,n){
		int y=-1,tj=-1;
		rep(j,n){
			if(f[j]) continue;
			if(r[j].first<b[i].first&&r[j].second<b[i].second){
				if(r[j].second>y){
					tj=j;
					y=r[j].second;
				}
			}
		}
		if(tj!=-1) f[tj]=true;
	}
	int ans=0;
	rep(i,n) if(f[i]) ans++;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
n = gets.to_i
s = gets.split.map(&:to_i)
_ = gets.to_i
t = gets.split.map(&:to_i)

sum = 0

def search(s, n, key)
  i = 0
  s[n] = key

  loop do
    break if s[i] == key
    i += 1
  end
  (n == i) ? false : true
end

t.each do |key|
  sum += 1 if search(s, n, key)
end
puts sum


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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

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;}


int main(){
  int n;cin>>n;
  vector<ll> a(n),b(n),c(n);
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  rep(i,n)cin>>c[i];
  sort(ALL(a));
  sort(ALL(b));
  sort(ALL(c));
  ll ans=0;
  rep(i,n){
    ll bs=b[i];
    ll x=lower_bound(ALL(a),bs)-a.begin();
    ll y=c.end()-upper_bound(ALL(c),bs);
    ans += x*y;
  }
  cout <<ans;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[1111], b[111], c[111], d[111];
int n, m, q;
vector<pair<pair<int, int>, int> > v[111];
vector<int> v1;
ll ans, mx;
void solve(int x){
	if(x==n+1){
		ans=max(mx, ans);
		return;
	}
	int tmp=v1.back();
	for(int i=tmp; i<=m; ++i){
		int sm=0;
		for(auto it:v[x]){
			if(i-v1[it.fs.fs-1]==it.fs.sc){
				sm+=it.sc;
			}
		}
		mx+=sm;
		v1.push_back(i);
		solve(x+1);
		mx-=sm;
		v1.pop_back();
	}
}
int main(){
    while(cin>>n>>m>>q){
        for(int i=0; i<q; ++i){
            scanf("%d%d%d%d",a+i,b+i,c+i,d+i);
            v[b[i]].push_back(mk(mk(a[i], c[i]), d[i]));
    	}
    	for(int i=1; i<=m; ++i){
    		v1.push_back(i);
    		solve(2);
    		v1.pop_back();
    	}
    	cout<<ans<<endl;
    }
  return 0;
}




Measured memory_bytes: 3672
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,k = LI()
    a = LI()
    bi = bisect.bisect_left(a, 0)
    r = inf
    if bi >= k:
        r = abs(a[bi-k])
    if bi+k-1 < n and r > a[bi+k-1]:
        r = a[bi+k-1]
    for i in range(1, n):
        if 0 > bi - i or bi + k - i - 1 >= n or bi + k - i - 1 < bi:
            continue
        t = -a[bi-i]
        u = a[bi+k-i-1]
        s = t + u + min(t,u)
        if r > s:
            r = s
    return r



print(main())


Measured memory_bytes: 16776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n;
  cin >> n;
  map <ll, ll> score;
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) {
      score[i] = 1;
      n /= i;
      while (n%i == 0) {
        score.at(i)++;
        n /= i;
      }
    }
  }
  if (n > 1) score[n] = 1;
  ll res = 0;
  for (auto p : score) {
    ll tmp = p.second;
    ll flag = 1, z = 1;
    while (z <= tmp) {
      flag++;
      z = (flag+1)*flag/2;
    }
    res += flag-1;
  }
  cout << res << endl;
}

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

int main() {
  int n, m, a, b;
  cin >> n >> m;
  vector<vector<int>> d(n);
  rep(i, m) {
    cin >> a >> b;
    a--, b--;
    d[a].push_back(b);
    d[b].push_back(a);
  }

  rep(i, d[0].size()) {
    int ni = d[0][i];
    rep(j, d[ni].size()) {
      if (d[ni][j] == n - 1) {
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 12016
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int a, b, k;

int main()
{
    cin >> a >> b >> k;
    set<int> s;
    for(int i = a; i < min(a + k, b); i++) s.insert(i);
    for(int i = b; i > max(b - k, a); i--) s.insert(i);
    if(a == b) s.insert(a);
    for(auto v: s) cout << v << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define CHAL_BC_APNE_BAAP_KO_MAT_SIKHA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define fr first
#define se second
#define mod 1000000007
signed main()
{
	CHAL_BC_APNE_BAAP_KO_MAT_SIKHA;		
	int n;
	cin>>n;
	int cnt=0;
	int ans=INT_MAX;
	for(int i=1;i<=n;i++)
	{
		int tmp;
		cin>>tmp;
		if(tmp<ans){
			ans=min(tmp,ans);
			cnt++;
		}
		ans=min(tmp,ans);
	}
	cout<<cnt<<endl;

}


Measured memory_bytes: 256
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' {}'.format(house[i][j][k]), end='')
        print()
    if i != 3:
        print('#' * 20)

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

int main() {
  /* code */
  string s;
  int count=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='1') ++count;
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

//typedef long long ll;
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE=2'000'000;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
    inv[1]=1;
    for(int i=2;i<=SIZE;i++){
        inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
    }
    
    kai[0]=invkai[0]=1;
    for(int i=1;i<=SIZE;i++){
        kai[i]=(kai[i-1]*i)%MOD;
        invkai[i]=(invkai[i-1]*inv[i])%MOD;
    }
}

long long comb(long long a, long long b){
    if(b<0 || a<b){
        return 0;
    }
    return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}

int main(){
  invinit();
  long long x,y;
  cin>>x>>y;
  long long a,b;
  if((2*x-y)%3 == 0){
    a = (2*x-y)/3;
  }else{
    cout<<0<<endl;
    return 0;
  }
  if((2*y-x)%3 == 0){
    b = (2*y-x)/3;
  }else{
    cout<<0<<endl;
    return 0;
  }
  
  long long ans = comb(a+b,a);
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 47104
/* Those who cannot remember the past are condemned to repeat it.*/
/* author:Ajeet */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
#define ll long long int
#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
const int sz=1e7;
#define mod 1000000007
#define ull unsigned long long int
int main()
{
    int n;
    int k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    ll dp[n];
    for(int i=0;i<n;i++) dp[i]=INT32_MAX;
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
   // int jump=0;
    for(int i=2;i<n;i++){
        for(int j=i-1,jump=0;j>=0 and jump<k;j--,jump++)
        dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
    }
    cout<<dp[n-1]<<endl;

    return 0;

}


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int n;
int a[25];
int solve(int des,int index)
{
    if(index>n) return 0;
    if(des==0)  return 1;
    return solve(des-a[index],index+1)||solve(des,index+1);
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    int t;
    cin>>t;
    while(t--)
    {
        int x;
        cin>>x;
        int flag=solve(x,0);
        if(flag)
            cout<<"yes";
        else
            cout<<"no";
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
int main(){
  vector<int> tall;
  for(int i=0;i<10;i++){
    int t;
    cin>>t;
    tall.push_back(t);
    }
  sort(tall.begin(),tall.end());
  for(int j=0;j<3;j++)
    cout<<tall[9-j]<<endl;
  return 0;
}

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

using namespace std;

int main()
{
    int n;
    long long sum{};
    cin >> n;
    if(n == 1)
    {
        sum = 1;
    }
else
{
	for(int i = 1; i <= n; i++)
    {
        if(!(i%3 == 0 || i%5 == 0)){
            sum += i;
        }
    }

}
cout << sum << "\n";
}



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

using namespace std;

typedef long long  ll;

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

    string in;

    while (cin >> in, in != "#") {
        vector<char> sep;

        for (int i = 0; i < in.size(); ++i) {
            if (in[i] == 'w') {
                sep.push_back('w');
                i += 3;
            }
            else if (in[i] == 'n') {
                sep.push_back('n');
                i += 4;
            }
        }

        const int n = sep.size();
        int up = ((sep[n - 1] == 'w') ? 90 : 0);
        int down = 1;

        for (int i = n - 2; i >= 0; --i) {
            up *= 2;
            if (sep[i] == 'w')
                up += 90;
            else if (sep[i] == 'n')
                up -= 90;
            down *= 2;
        }

        int gcd = __gcd(up, down);
        up /= gcd;
        down /= gcd;
        
        if (up == 0)
            cout << 0 << endl;
        else if (down == 1)
            cout << up << endl;
        else
            cout << up << "/" << down << endl;
    }

    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <array>
#include <string>

using namespace std;
 
int f(char a, char b)
{
    if (a == 'R' && b == 'G') return 2;
    if (a == 'R' && b == 'B') return 1;
    if (a == 'G' && b == 'B') return 0;
    return f(b, a);
}

int g(char a)
{
	if (a == 'R') return 0;
    if (a == 'G') return 1;
    return 2;
}

char h[3] = {'R', 'G', 'B'};

int main()
{
    int n;
    long long ans = 0;
    cin >> n;
    vector<array<int, 3>> v(n);
    string s;
    cin >> s;
    v[0][0] = 0;
    v[0][1] = 0;
    v[0][2] = 0;
    v[0][g(s[0])]++;
    for(int i = 1; i < n; i++)
    {
        v[i][0] = v[i-1][0];
        v[i][1] = v[i-1][1];
        v[i][2] = v[i-1][2];
        v[i][g(s[i])]++;
    }
    for (int i = 0; i < n - 2; i++)
    {
        for (int i2 = i + 1; i2 < n - 1; i2++)
        {
            if (s[i] == s[i2]) continue;
            int nr = f(s[i], s[i2]);
            ans += (v[n-1][nr] - v[i2 - 1][nr]);
            if (i2 + i2 - i < n && s[i2 + i2 - i] == h[nr]) ans--;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3660