akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
	int n;
	int i,j,k;
	int count = 0;
	int tmp[100];
	int station[52];
	int num[100];
	char str[256];
	for(i = 0;i < 26;i++){
		station[i] = i + 97;
	}
	for(i = 26;i < 52;i++){
		station[i] = i + 39;
	}
	while(scanf("%d",&n)){
		if(n == 0){
			break;
		}
		for(i = 0;i < n;i++){
			scanf("%d",&num[i]);
		}
		scanf("%s",str);
		i = 0;
		k = 0;
		while(str[i] != '\0'){
			for(j = 0;j < 52;j++){
				if(str[i] == station[j]){
					tmp[i] = j - num[k];
					if(tmp[i] < 0){
						tmp[i] += 52;
					}
				}
			}
			i++;
			k++;
			count++;
			if(k == n){
				k = 0;
			}
		}
		for(i = 0;i < count;i++){
			printf("%c",station[tmp[i]]);
		}
		printf("\n");
		count = 0;
	}
	return 0;
}

Measured memory_bytes: 576
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
vector<pii>x,y;
int X,Y,n,boss[100005],ans,a,b,c;
priority_queue<pair<int,pii> >pq;
int F(int N)
{
    if(N==boss[N])return boss[N];
    else return boss[N]=F(boss[N]);
}
void un(int x,int y)
{
    boss[F(x)]=F(y);
    return;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        boss[i]=i;
        scanf("%d %d",&X,&Y);
        x.pb({X,i});
        y.pb({Y,i});
    }
    sort(all(x));
    sort(all(y));
    for(int i=1;i<n;i++)
    {
        pq.push({-abs(x[i].F-x[i-1].F),{x[i].S,x[i-1].S}});
        pq.push({-abs(y[i].F-y[i-1].F),{y[i].S,y[i-1].S}});
    }
    while(!pq.empty())
    {
        c=-pq.top().F;
        a=pq.top().S.F;
        b=pq.top().S.S;
        pq.pop();
        //printf("{%d %d %d}\n",a,b,c);
        if(F(a)!=F(b))
        {
            //printf("{%d %d %d}\n",a,b,c);
            un(a,b);
            ans+=c;
        }
    }
    printf("%d",ans);
}


Measured memory_bytes: 10908
#include <iostream>
#include <string>

using namespace std;

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

int main() {
  string s;
  cin >> s;
  int size = s.size();
  int answer = 0;
  Rep(i, size / 2) {
    if (s[i] != s[size - i - 1]) {
      answer++;
    }
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define vvll vector<vll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define NO() cout<<"NO"<<endl
#define YES() cout<<"YES"<<endl
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sot(v) sort(v.begin(),v.end());
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

void solve()
{
    ll i,j,k,l,n;
    string s;
    cin>>s;
    ll ans=0;
    if(s[0]=='R' && s[1]=='R' && s[2]=='R')  cout<<3<<ee;
    else if(s[0]=='R' && s[1]=='R') cout<<2<<ee;
    else if(s[1]=='R' && s[2]=='R') cout<<2<<ee;
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R') cout<<1<<ee;
    else cout<<0<<ee;

}


int main() {
    fast;
    ll i,j,l,k,t,n;
    t=1;
    while(t--)
    solve();
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <cstdint>
using namespace std;

int main() {
	vector<bool> is_prime(100020, true);
	is_prime[0] = is_prime[1] = 0;
	for (int i = 2; i <= 100010; i++) {
		if (!is_prime[i]) continue;
		for (int j = 2 * i; j <= 100010; j += i) {
			is_prime[j] = 0;
		}
	}
	vector<int> sum(100020);
	for (int i = 0; i <= 100010; i++) {
		sum[i] = is_prime[i] && is_prime[(i + 1) / 2];
	}
	for (int i = 0; i <= 100010; i++) {
		sum[i + 1] += sum[i];
	}
	int Q; cin >> Q;
	while(Q--) {
		int l, r; cin >> l >> r;
		cout << sum[r] - sum[l - 1] << "\n";
	}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define N 305
#define P 1000000007
using namespace std;
int n,m,dp[N][N][N],ans;
struct T
{
	int x,y;
};
vector<T>v[N];
void upd(int &x,int y)
{
	x=x+y;
	if (x>P) x-=P;
}
bool pd(int s[3],int t)
{
	int a[4];
	a[0]=0;a[1]=s[0];a[2]=s[1];a[3]=s[2];
	sort(a,a+4);
	for (int i=0;i<v[t].size();i++)
		if (!(v[t][i].x>a[3-v[t][i].y]&&v[t][i].x<=a[4-v[t][i].y]))
			return 0;
//	cout<<s[0]<<' '<<s[1]<<' '<<s[2]<<'-'<<t<<endl;
	return 1;
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		v[y].push_back((T){x,z});
	}
	dp[0][0][0]=1;
	for (int a=0;a<=n;a++)
	for (int b=0;b<=n;b++)
	for (int c=0;c<=n;c++)
	{
		int t=max(a,max(b,c))+1,s[3];
		if (t>n)
		{
			upd(ans,dp[a][b][c]);
			continue;
		}
		s[0]=a;s[1]=b;s[2]=c;
		for (int k=0;k<=2;k++)
		{
			int tmp=s[k];s[k]=t;
			if (pd(s,t))
				upd(dp[s[0]][s[1]][s[2]],dp[a][b][c]);
			s[k]=tmp;
		}
	}
	//cout<<dp[0][0][1]<<endl;
	printf("%d\n",ans);
}

Measured memory_bytes: 110848
/**
 * ????????°

???????????????????????°??¶???????????? s
???????????????????????????????¨????????????£?¶????????????????????????????????????§???????????? p
??????????????????????????????????????°????????????????????????????????????




Input
????????????????????? s ????????????????????????
????????????????????? p ????????????????????????

Output
p ??????????????´?????? Yes ??¨?????????????????´?????? No ??¨????????????????????????????????????

Constraints
1???p????????????s????????????100
??????????????±?°???????????????????

Sample Input 1
vanceknowledgetoad
advance

Sample Output 1
Yes

Sample Input 2
vanceknowledgetoad
advanced

Sample Output 2
No

 */

#include <iostream>
#include <sstream>

int main(int argc, char const *argv[]) {
  std::string s;
  std::string p;
  getline(std::cin, s);
  getline(std::cin, p);

  std::string ss = s + s;
  auto pos = ss.find(p);
  if (pos != std::string::npos) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  return 0;
}

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

int H, W;
string s[100];

int dfs(int x, int y, char c)
{
  if(x < 0 || x >= W || y < 0 || y >= H || c != s[y][x])
    return 1;
  s[y][x] = 'A';
  dfs(x + 1, y, c);
  dfs(x - 1, y, c);
  dfs(x, y + 1, c);
  dfs(x, y - 1, c);
  return 1;
}

int main()
{
loop:
  int ans = 0;
  cin >> H >> W;
  if(!H)
    return 0;
  for(int i = 0; i < H; i++)
    cin >> s[i];
  for(int y = 0; y < H; y++)
    for(int x = 0; x < W; x++)
      if(s[y][x] != 'A')
        ans += dfs(x, y, s[y][x]);
  cout << ans << endl;
  goto loop;
}

Measured memory_bytes: 2000
#include<stdio.h>
int main(){
    int a,b,i,j;
    scanf("%d %d",&a,&b);
    while(1){
        if(a==0&&b==0){
            break;
        }
        else{
            for(j=0;j<b;j++){
                printf("#");
            }
            printf("\n");
            for(i=1;i<a-1;i++){
                printf("#");
                for(j=1;j<b-1;j++){
                    printf(".");
                }
                printf("#");
                printf("\n");
            }
            for(j=0;j<b;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
        scanf("%d %d",&a,&b);
    }
    return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;

int main(){
  int a,b,h,m;
  cin >> a >> b >> h >> m;
  double aa = (double)(h%12)*360.0/12.0+((double)m/60.0)*(1.0/12.0)*360;

  double bb = (double)m/60.0*360;
  double tmp = fabs(aa-bb);
  double ans = a*a+b*b-(double)(2*a*b*cos(tmp*(2*M_PI)/360));
  cout << fixed << setprecision(9) << sqrt(ans) << endl;
  return 0;
}

Measured memory_bytes: 4292
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long x,k,d;
	cin>>x>>k>>d;
	x = abs(x);
	long long r1 = x%d;

	long long r2 = d - r1;
	long long moves,ans;
	if(r1<=r2)
	{
		moves = x/d;
	}
	else
	{
		moves = x/d + 1;
	}
	// printf("Moves %d\n",moves );
	if(k<=moves)
	{
		ans = x - k*d;
	}
	else
	{
		if((k-moves)%2==0)
			ans = x - moves*d;
		else
			ans = max(r1,r2);
	}
	cout<<abs(ans)<<endl;
	
	return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static int[] rank;

	static void solve() {
		out.println(rank[in.nextInt()]);
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		ArrayList<int[]> list = new ArrayList<int[]>();

		while (true) {
			String[] s = in.next().split(",");
			int t = Integer.parseInt(s[0]);
			int c = Integer.parseInt(s[1]);
			if (t + c == 0) break;
			list.add(new int[]{t,c});
		}

		Collections.sort(list,new Comparator<int[]>(){
			public int compare(int[] a, int[] b) {
				return b[1] - a[1];
			}
		});

		rank = new int[list.size()+1];

		int r = 0, c = Integer.MAX_VALUE;
		for (int i=0; i<list.size(); i++) {
			int[] cur = list.get(i);
			if (c > cur[1]) {
				r++;
				c = cur[1];
			}
			rank[cur[0]] = r;
		}

		while(in.hasNext()) solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(x,n) for(auto& (x) : n)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define inf 1000000000
#define llinf 1000000000000000
#define MAX 1000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;
typedef pair<int,pint> P;

int main(){
    int a,b,t;
    cin>>a>>b>>t;
    cout<<(int)t/a*b<<endl;
}

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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int k,x;
  cin >> k>> x;
  if(500*k>=x)cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn = 100010;
const int mod = 1e9+7;

typedef long long ll;

int n  = 0;
int A[maxn];
int jc[maxn], ijc[maxn], inv[maxn];
int sum[maxn], val[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &A[i]);
    inv[1] = 1;
    for (int i = 2; i <= n; i++) {
        inv[i] = 1ll*(mod/i)*(mod-inv[mod%i])%mod;
    }
    jc[0] = ijc[0] = 1;
    for (int i = 1; i <= n; i++) {
        jc[i] = 1ll*jc[i-1]*i%mod;
        ijc[i] = 1ll*ijc[i-1]*inv[i]%mod;
    }
    for (int i = 1; i <= n; i++)
        val[i] = 1ll*jc[n]*inv[i]%mod;
    val[1] = 0;
    sum[0] = 0;
    for (int i = 1; i <= n; i++) sum[i] = (sum[i-1]+val[i])%mod;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int l1 = i, l2 = n-i+1;
        if (l1 > l2) swap(l1, l2);
        (ans += (((2ll*sum[l1]%mod)%mod+sum[l2]-sum[l1])%mod+mod)%mod*A[i]%mod)%=mod;
    }
    for (int i = 1; i <= n; i++) ans = (ans + 1ll*A[i]*jc[n]%mod)%mod;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define clr(a,x) memset(a,x,sizeof(a))
#define SZ(x) ((int)(x).size())
#define lson rt<<1
#define rson rt<<1|1
#define pb push_back
#define fi first
#define se second
#define what_is(x) cerr<<#x<<" "<<x<<endl;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
template <typename T>
inline void _read(T& x){
    cin>>x;
}
void R(){}
template <typename T,typename... U>
void R(T&head,U&... tail){
    _read(head);
    R(tail...);
}

template <typename T>
inline void _write(const T& x){
    cout<<x<<' ';
}
void W(){cout<<endl;}
template <typename T,typename... U>
void W(const T&head,const U&... tail){
    _write(head);
    W(tail...);
}

void go();
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    go();
    return 0;
}
/****************ackun*********************/
void go(){
    int n;
    R(n);
    map<int,int> mmp1,mmp2;
    rep(i,1,n){
        int x;
        R(x);
        if(i&1){
            mmp1[x]++;
        }else{
            mmp2[x]++;
        }
    }
    vector<pii> a1,a2;
    for(auto x:mmp1){
        a1.pb({-x.se,x.fi});
    }
    for(auto x:mmp2){
        a2.pb({-x.se,x.fi});
    }
    sort(a1.begin(),a1.end());
    sort(a2.begin(),a2.end());
    if(a1[0].se==a2[0].se){
        if(a1.size()==1&&a2.size()==1){
            W(n/2);
        }else if(a1.size()==1&&a2.size()>1){
            W(n/2+a2[1].fi+n/2+a1[0].fi);
        }else if(a1.size()>1&&a2.size()==1){
            W(n/2+a1[1].fi+n/2+a2[0].fi);
        }else{
            W(min(n+a1[0].fi+a2[1].fi,n+a1[1].fi+a2[0].fi));
        }
    }else{
        W(n/2+a1[0].fi+n/2+a2[0].fi);
    }
}


Measured memory_bytes: 6140
! ビット全探索？
   program abc167c
      implicit none
      integer::n,m,x
      integer,allocatable,dimension(:)::c,got
      integer,allocatable,dimension(:,:)::a
      integer::i,j,k,l
      integer::candi_bit,cost,check,ans=10000000

         read *, n,m,x
         allocate(c(n),a(n,m),got(m))
         do i=1,n
            read *, c(i), a(i,1:m)
         end do

         do i=0,2**n-1
            check=0
            candi_bit=i
            cost=0
            got=0

            do j=1,n

               if (and(candi_bit,1)==1) then
                  cost=cost+c(j)

                  do k=1,m
                     got(k)=got(k)+a(j,k)
                  end do

               end if

               candi_bit=candi_bit/2
            end do

            do l=1,m
               if (got(l)<x) check=1
            end do

            if (check==0 .and. ans>cost) ans=cost

         end do

         if (ans/=10000000) then
            print *, ans
         else
            print *, '-1'
         end if

   end program abc167c

Measured memory_bytes: 2776
import java.util.*;

public class Main {           
    
    public static void main(String[] args) {		        
        Scanner sc = new Scanner(System.in);                               
        
        int N = sc.nextInt();        
        
        int max = Integer.MIN_VALUE;
        
        int ans = -1;
        for(int i= 1;i <= N;i++){            
            if(two(i) > max){
               ans = i;
            }            
            max = Math.max(max,two(i));            
        }            
        
        System.out.println(ans);
        
    }       
    
    private static int two(int N){
        
        int count = 0;
        
        while(true){
           if(N%2 == 0){
               count++;
               N = N/2;
           }else{
               break;
           }            
        }
        
        return count;
        
    }
    
}


Measured memory_bytes: 23760
a,b,k=map(int,input().split())
if 2*k>=(b-a+1):
  for h in range(a,b+1):
    print(h)
else:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
    print(j)


Measured memory_bytes: 3060
#include<stdio.h>

int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a+b > a-b){
    if(a+b > a*b){printf("%d\n",a+b);}
    else{printf("%d\n",a*b);}
  }else{
    if(a-b > a*b){printf("%d\n",a-b);}
    else{printf("%d\n",a*b);}
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n,k;
  cin>>n>>k;
  int now = 1;
  rep(i, n) {
    if(now < k) {
      now *= 2;
    } else {
      now += k;
    }
  }
  cout << now << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std ;
using ll = long long ;
using vll = vector<ll> ;

vll fac(1000000,1) ;
vll inv(1000000) ;
vll finv(1000000,1) ;
ll mod = 1000000007 ;

ll ncr(ll n,ll r){
    if(n<r) return 0 ;
    if(n<0||r<0) return 0 ;
    return fac.at(n)*(finv.at(r)*finv.at(n-r)%mod)%mod ;
}

int main(){
    ll h,w,a,b ;
    cin >> h >> w >> a >> b ;
    inv.at(1) = 1 ;
    for(int i=2;i<1000000;i++){
        fac.at(i) = fac.at(i-1)*i%mod ;
        inv.at(i) = mod-inv.at(mod%i)*(mod/i)%mod ;
        finv.at(i) = finv.at(i-1)*inv.at(i)%mod ;
    }
    ll ans = 0 ;
    for(int i=0;i<h-a;i++){
        ll fst = ncr(i+b-1,i) ;
        ll scd = ncr(h-i+w-b-2,h-i-1) ;
        ans += fst*scd%mod ;
    }
    cout << (ans+mod)%mod << endl ;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

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

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


int main(){
    int N; cin >> N;
    vector<vector<int>> h(N, vector<int>(3));
    rep(i, N){
        rep(j, 3) cin >> h[i][j];
    }
    vector<vector<int>> dp(N, vector<int>(3, -1));//i日目に行動jをした場合の最大値
    dp[0][0] = h[0][0];
    dp[0][1] = h[0][1];
    dp[0][2] = h[0][2];

    rep(i, N - 1){
        chmax(dp[i + 1][0], max(dp[i][1] + h[i + 1][0], dp[i][2] + h[i + 1][0]));
        chmax(dp[i + 1][1], max(dp[i][0] + h[i + 1][1], dp[i][2] + h[i + 1][1]));
        chmax(dp[i + 1][2], max(dp[i][0] + h[i + 1][2], dp[i][1] + h[i + 1][2]));
    }

    cout << max({dp[N - 1][0], dp[N - 1][1], dp[N - 1][2]}) << endl;

}

Measured memory_bytes: 14088
n=gets.to_i
l=[[]]
n.times do
  l << []
end
t=[]
(n-1).times do
  a,b=gets.split.map(&:to_i)
  l[a] << b
  l[b] << a
  t << [a,b]
end
k=0
l.each do |ll|
  k=ll.size if k<ll.size
end
puts k
h={}
c=[0,0]
s=[1]
i=0
while s!=[]
  z=[]
  s.each do |ss|
    l[ss].each do |lss|
      a,b=[ss,lss].sort
      if !h.has_key?([a,b])
        i=(i%k)+1
        i=(i%k)+1 if i==c[ss]
        h[[a,b]]=i
        c[lss]=i
        z << lss
      end
    end
  end
  s=z.dup
end
t.each do |tt|
  puts h[tt]
end


Measured memory_bytes: 39456
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a,b = li()
p = list(li())

one = 0
two = 0
thr = 0
for pi in p:
    if pi <= a:
        one += 1
        
    elif pi <= b:
        two += 1
        
    else:
        thr += 1
        
print(min(one,two,thr))

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a) for(__typeof((a).begin()) i=(a).begin(), _##i=(a).end(); i!=_##i; ++i)
#define dwni(i,a) for(__typeof((a).rbegin()) i=(a).rbegin(), _##i=(a).rend(); i!=_##i; ++i)
#define SZ(a) ((int)((a).size()))
#define printCase() "Case #" << caseNum << ": "
#define pb push_back
#define mp make_pair
#define INF ((int)1e9)
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);
#define ff first
#define ss second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main() {
    SYNC
    ll x, y;
    cin >> x >> y;
    if(x < y) swap(x,y);
    if(x - y > 1) cout << "Alice";
    else cout << "Brown";
}

Measured memory_bytes: 256
A,B,Q = map(int,input().split())
S = [-10**11] + [int(input()) for _ in [0]*A] + [10**11]
T = [-10**11] + [int(input()) for _ in [0]*B] + [10**11]
X = [int(input()) for _ in [0]*Q]

def binary_search(A,func):
    l = 0
    r = len(A)-1
    if func(0,A):return -1
    if not func(r,A):return r
    while l+1<r:
        i = (l+r)//2
        if func(i,A):
            r = i
        else:
            l = i
    return l

for x in X:
    a = binary_search(S,lambda i,A:A[i]>=x)
    s = S[a:a+2]
    b = binary_search(T,lambda i,A:A[i]>=x)
    t = T[b:b+2]
    print(min(x-min(s[0],t[0]),
              max(s[1],t[1])-x,
              x-s[0]+t[1]-x+min(x-s[0],t[1]-x),
              x-t[0]+s[1]-x+min(x-t[0],s[1]-x) ))

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

int main() {
    int n,m;
    cin>>n>>m;
    int a[m];
    for (int i=0;i<m;i++)
        cin>>a[i];
    sort(a,a+m);
    int b[m-1];
    for (int i=1;i<m;i++)
        b[i-1]=a[i]-a[i-1];
    sort(b,b+m-1);
    int ans=0;
    for (int i=0;i<m-n;i++)
        ans+=b[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
 
int main(){
  char num[3];
  for(int i=0; i<3; i++){
	cin >> num[i];
  }
  
  for(int i=0; i<3; i++){
	if(num[i]=='7'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3040
import sys

input = sys.stdin.readline
N = list(map(int, input().strip()))[::-1]
ans = 0
before = 0
L = len(N)
for i, c in enumerate(N):
    n = c + before
    if 0 <= n < 5:
        before = 0
        ans += n
    elif n == 5:
        if i+1 == L:
            before = 0
            ans += n
            continue
        if N[i+1] < 5:
            before = 0
            ans += n
        else:
            ans += 10-n
            before = 1
    else:
        ans += 10-n
        before = 1
print(ans + before)



Measured memory_bytes: 20336
#include <cstdio>
#include <iostream>
#define MAX 1000005

typedef struct _processInfo {
  char name[20];
  int time;
}processInfo;

processInfo processInQueue[MAX];
int head=0, tail=0, numOfProcess;

void enqueue(processInfo);
processInfo dequeue();
bool isEmpty();

using namespace std;
int main() {
  int currentTime = 0;
  int q;

  processInfo tmpProcess;

  scanf("%d", &numOfProcess);
  scanf("%d", &q);
  for(int i = 0; i < numOfProcess; i++) {
    scanf("%s", processInQueue[i].name);
    scanf("%d", &processInQueue[i].time);
  }
  tail = numOfProcess;

  while(!isEmpty()) {
    tmpProcess = dequeue();
    
    if(tmpProcess.time <= q) {
      currentTime += tmpProcess.time;
      printf("%s ", tmpProcess.name);
      printf("%d\n", currentTime);
    } else {
      currentTime += q;
      tmpProcess.time -= q;
      enqueue(tmpProcess);
    }
  }

  return 0;
}

bool isEmpty() {
  return head == tail;
}

void enqueue(processInfo tmpProcess) {
  processInQueue[tail] = tmpProcess;
  if(tail == MAX-1) tail = 0;
  else tail++;
}

processInfo dequeue() {
  if(head == MAX-1) {
    head = 0;
    return processInQueue[MAX-1];
  } else {
    head++;
    return processInQueue[head-1];
  }
}


Measured memory_bytes: 7636
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> s(n);
  int i;
  int cnt = 0;
  for(i=0;i<n;i++) cin >> s[i];
  for(i=1;i<n-1;i++){
    if((s[i-1]<s[i]&&s[i]<s[i+1])||(s[i-1]>s[i]&&s[i]>s[i+1])) cnt++;
  }
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 3636
import std.stdio, std.string, std.array, std.conv, std.algorithm;

void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.chomp.split.to!(int[]);
    a = a.uniq.array;
    foreach (i, x; a) {
        x.write;
        if (i != a.length - 1) " ".write;
        else writeln;
    }
}


Measured memory_bytes: 5864
#include <stdio.h>

char S[114514];

int main(void) {
	int count = 0;
	int i;
	if (scanf("%114513s", S) != 1) return 1;
	if (S[0] != '\0') {
		for (i = 1; S[i] != '\0'; i++) {
			if (S[i - 1] != S[i]) count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i,c,b) for(int i=c;i<b;i++)
#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl printf("\n")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define MAX 1000001
typedef long long int ll;

using namespace std;



int main(){
    si(n);
    double a[n];
    fr(i,0,n)
        cin>>a[i];
    double ans=0;
    fr(i,0,n)
        ans+=1/a[i];
    cout<<1/ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double dp[3001][3001];
double solve(vector<double> &ar, int i, int x)
{
    if(x==0)return 1;
    if(i==0)return 0;
    if(dp[i][x]>-0.9)return dp[i][x];
    return dp[i][x] =  ar[i]*solve(ar, i-1, x-1) + (1-ar[i])*solve(ar, i-1, x);
}
int main()
{
    int n;
    cin>>n;
    memset(dp, -1, sizeof(dp));
    vector<double> ar(n+1);
    for(int i =1; i<n+1; ++i )
    {
        cin>>ar[i];
    }
    cout << setprecision(16) << solve(ar, n, (n+1)/2);
}

Measured memory_bytes: 74384
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

while True:
    s = input()
    if s == "-":
        break
    m = int(input())
    d = getSomeInputInt(m)

    for tmp_d in d:
        s = s[tmp_d:] + s[:tmp_d]
    print(s)


Measured memory_bytes: 6888
l,r=map(int,input().split())
m=2019
if l//m<r//m:
  print(0)
else:
  ans=m
  for i in range(l%m, r%m+1):
    for j in range(i+1,r%m+1):
      ans=min(ans,i%m*j%m)
  print(ans)


Measured memory_bytes: 9076
package main

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

func main() {
	sc := NewScanner()
	A, B, C := sc.NextInt(), sc.NextInt(), sc.NextInt()
	sum := A + B + C
	if sum >= 22 {
		fmt.Println("bust")
	} else {
		fmt.Println("win")
	}
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n, k;
	cin >> n >> k;
	vector<int>a(n);
	vector<int>visited(n+1, -1);
	vector<int>s;
	rep(i, n) {
		cin >> a[i];
	}
	int v = 1;
	while (visited[v] == -1) {
		visited[v] = s.size();
		s.pb(v);
		v = a[v - 1];
	}
	int c = s.size() - visited[v];
	int l = visited[v];

	if (k < l)print(s[k]);
	else {
		int amari = (k - l) % c;//0<=amari<(new1-old1)
		print(s[l + amari]);
	}
}

Measured memory_bytes: 8424
def card_eater(N: int, A: list)->int:
    d = {}
    for a in A:
        d.setdefault(a, -1)
        d[a] += 1

    exceeds = sum(v for v in d.values())

    return N - exceeds - exceeds % 2


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    ans = card_eater(N, A)
    print(ans)


Measured memory_bytes: 17312
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}
class Array
  define_method(:sum){self.inject(:+)} unless method_defined?(:sum)
end

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end

N, a_list = gets_n_and_i_list

f = (a_list.sum.to_f / N).floor
c = (a_list.sum.to_f / N).ceil

f_total = a_list.inject(0) do |s, a|
  s = s + (a - f) ** 2
end

c_total = a_list.inject(0) do |s, a|
  s = s + (a - c) ** 2
end

puts [f_total, c_total].min

Measured memory_bytes: 2172
import sys

n = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split()]

a_set = set()
counter_wild = 0
for x in a:
    if x>=3200:
        counter_wild+=1
    else:
        a_set.add(x//400)
print(max(1,len(a_set)),len(a_set)+counter_wild)


Measured memory_bytes: 38384
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
	long long n,a[5];
	cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	if(n % min({ a[0],a[1],a[2],a[3],a[4] }) == 0)
	{
		cout << (n) / min({ a[0],a[1],a[2],a[3],a[4] }) + 4 << endl;
	}
	else { cout << (n - 1) / min({ a[0],a[1],a[2],a[3],a[4] }) + 5 << endl; }
	return 0;
}

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

using namespace std;

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

	int before = atoi(s.substr(0,2).c_str());
	int back = atoi(s.substr(2,2).c_str());

	bool MMYY = false;
	bool YYMM = false;
	if (1 <= before && before <= 12) {
		MMYY = true;
	}
	if (1 <= back && back <= 12) {
		YYMM = true;
	}

	if (YYMM && MMYY) {
		cout << "AMBIGUOUS" << endl;
	}
	else if (YYMM) {
		cout << "YYMM" << endl;
	}
	else if (MMYY) {
		cout << "MMYY" << endl;
	}
	else
	{
		cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld double
long double PI =3.14159265;
using ll = long long;

const ll modo=1e9+7;
const ll ms=1e5+5;
const ll inf=1e9+9;


int main()
{
    idfc;

    int n,x,t;
    cin>>n>>x>>t;


    int pp=n/x;
    if(n%x)pp++;

    int ans=t*pp;
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
int main(){
  int x,n,i,j;
  scanf("%d%d",&x,&n);
  int p[n+1];
  if(n==0){
    printf("%d\n",x);
    return 0;
  }
  for(i=0;i<n;i++)
    scanf("%d",&p[i]);
  for(i=0;i<=n;i++){
    int left=0,right=0;
    for(j=0;j<n;j++){
      if(x-i==p[j])
        left=1;
      if(x+i==p[j])
        right=1;
    }
    if(left==0){
      printf("%d\n",x-i);
      return 0;
    }
    else if(right==0){
      printf("%d\n",x+i);
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 1708
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
string s,b;
cin>>s;
for(int i=0;i<s.size();i=i+2)
b=b.substr(0,(i+2)/2-1)+s[i];
cout<<b;
system ("pause");
return 0;
}

Measured memory_bytes: 768
from math import sqrt
from collections import deque

sin30 = 1 / 2
cos30 = sqrt(3) / 2
""" Direct length p1-u when p1-p2 is 1 """
p1_to_u = 1 / sqrt(3)


def koch(xy1, xy2):
    global sin30, cos30, p1_to_u
    (x1, y1) = xy1
    (x2, y2) = xy2
    dx, dy = x2 - x1, y2 - y1
    dx3, dy3 = dx / 3, dy / 3
    yield (x1 + dx3, y1 + dy3)
    xu, yu = dx * p1_to_u, dy * p1_to_u
    xu, yu = x1 + cos30 * xu - sin30 * yu, y1 + sin30 * xu + cos30 * yu
    yield (xu, yu)
    yield (x2 - dx3, y2 - dy3)


l = deque(((0.0, 0.0), (100.0, 0.0)))

for _ in range(int(input())):
    new_l = deque()
    prev_xy = l.popleft()
    for xy in l:
        new_l.append(prev_xy)
        new_l.extend(koch(prev_xy, xy))
        prev_xy = xy
    new_l.append(prev_xy)
    l = new_l

for xy in l:
    print(*xy)

Measured memory_bytes: 8704
#include <stdio.h>
#include <stdlib.h>
#define DEFAULT_VARR_SIZE 8

typedef struct { int w, v; } edge_t;
typedef struct { int size, i; edge_t *arr; } varr_t;

static void dfs(varr_t *g, int size, int *v, int *d, int m) {
  int i, n;
  edge_t e;

  v[m] = 1;
  for (i = 0; i < g[m].i; ++i) {
    e = g[m].arr[i];
    n = e.v;
    if (v[n]) continue;
    v[n] = 1;
    d[n] = d[m] + e.w;
    dfs(g, size, v, d, n);
  }
}

static int diameter(varr_t *g, int size, int *v, int *d) {
  int max, x, i;

  dfs(g, size, v, d, 0);
  for (i = x = max = 0; i < size; ++i) {
    if (max < d[i]) {
      x = i;
      max = d[i];
    }
    v[i] = d[i] = 0;
  }
  dfs(g, size, v, d, x);
  for (i = max = 0; i < size; ++i) {
    if (max < d[i]) max = d[i];
  }
  return max;
}

int main(int argc, char **argv) {
  int n, i, k, l, *v, *d;
  varr_t *g;
  edge_t e;

  scanf("%d", &n);
  v = (int *) malloc(sizeof(int) * n);
  d = (int *) malloc(sizeof(int) * n);
  g = (varr_t *) malloc(sizeof(varr_t) * n);
  for (i = 0; i < n; ++i) {
    v[i] = d[i] = g[i].i = 0;
    g[i].size = DEFAULT_VARR_SIZE;
    g[i].arr = (edge_t *) malloc(sizeof(edge_t) * g[i].size);
  }
  for (i = 0; i < n - 1; ++i) {
    scanf("%d %d %d", &k, &l, &e.w);
    e.v = l;
    if (g[k].i == g[k].size) {
      g[k].size *= 2;
      g[k].arr = (edge_t *) realloc(g[k].arr, sizeof(edge_t) * g[k].size);
    }
    g[k].arr[g[k].i++] = e;
    e.v = k;
    if (g[l].i == g[l].size) {
      g[l].size *= 2;
      g[l].arr = (edge_t *) realloc(g[l].arr, sizeof(edge_t) * g[l].size);
    }
    g[l].arr[g[l].i++] = e;
  }
  printf("%d\n", diameter(g, n, v, d));
  for (i = 0; i < n; ++i) free(g[i].arr);
  free(g); free(v); free(d);
}


Measured memory_bytes: 19420
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;


bool comp(int a, int b) {
  return a>b;
}
int H[200010];
int main() {
  int N,K; cin>>N>>K;
  rep(i,N) cin>>H[i];
  sort(H, H+N, comp);
  ll ans =0;
  for (int i=K; i<N; i++) {
    ans+=H[i];
  }
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    string s;
    cin>>s;
    rep(i,s.size())cout<<(char)((s[i]-'A'+n)%26+'A');cout<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, A, B) = Slice3<long>();
            WriteLine(Min(A * N, B));
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

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

int main() {
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;

    int tol = 0;
    if (N > K) {
        rep (i, K) {
            tol += 1 * X;
        }
        rep(i, N-K) {
            tol += 1 * Y;
        }
    } else {
        rep(i, N) {
            tol += 1 * X;
        }
    }
    
    cout << tol << endl;

    return 0;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.printf("%d %d %f", a / b, a % b, a * 1.0 / b);
	}
}

Measured memory_bytes: 17348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define in freopen("in.txt","r",stdin)
//#define out freopen("out.txt","w",stdout) 
ll n,m,j,k,t,l,r;
ll b,c,d;
char A,B,C,X,Y,Z;
ll ans,MAX,MIN=40,sum;
ll ax[200050],bx[200050];
//ll dp1[1000][1000],dp2[1000][1000];
//char str[200050];

int main()
{
    ll i,s,x;
    t=1;
    //scanf("%lld",&t);
    while(t--)
    {
		cin>>n;
		n=n%10;
		if(n==3) cout<<"bon";
		else if(n==0||n==1||n==6||n==8) cout<<"pon";
		else cout<<"hon";
	}
	return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
   
int n, G[110][110];
int u, k, v, cost, a, c[110], d[110], p[110];
 
void prim(){
 
  int i, j;
 
  for(i = 0; i < n; i++){
    c[i] = 0;
    p[i] = -1;
    d[i] = 1000000;
  }
   
  d[0]=0;
   
  while(1){
    cost = 1000000;
    for(i = 0; i < n; i++){
      if(c[i] != 2 && d[i] < cost){
    cost = d[i];
    a = i;
      }
    }
     
    if(cost == 1000000) break;
        
    c[a] = 2;
   
    for(i = 0; i < n; i++){
      if(G[a][i] != -1 && c[i] != 2 && (G[a][i] + d[a]) < d[i]){
    p[i]= a;
    d[i] = G[a][i] + d[a];
    c[i] = 1;
      }
    }
  }
   
  for(i = 0 ; i < n; i++)
    printf("%d %d\n", i, d[i]);
 
}
 
int main(){
  
  int i, j, c;
   
  for(i = 0; i < 110; i++){
    for( j = 0; j < 110; j++){
      G[i][j] = -1;
    }
  } 
 
  scanf("%d",&n);
   
  for(i = 0; i < n; i++){
    scanf("%d%d",&u,&k);
    for(j = 0 ;j < k ;j++){
      scanf("%d%d",&v,&c);
      G[u][v] = c;
    }
  }
   
  prim();
   
  return 0;
  
}

Measured memory_bytes: 648
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
RC112 C
"""

n = int(input())
xyhlist = [tuple(map(int,input().split())) for i in range(n)]
xyhlist0 = []
xyhlist1 = []
for x,y,h in xyhlist:
    if h == 0:
        xyhlist0.append((x,y))
    else:
        xyhlist1.append((x,y,h))

candidate = []
from itertools import product
for x,y in product(range(0,101),range(0,101)):
    test = set(map(lambda t:t[2]+abs(t[0]-x)+abs(t[1]-y),xyhlist1))
    if len(test) == 1:
        candidate.append((x,y,test.pop()))
    elif len(test) == 0:
        candidate.append((x,y,1))

for x,y,h in candidate:
    flag = True
    for x0,y0 in xyhlist0:
        if h-abs(x-x0)- abs(y-y0)>0:
            flag = False
    if flag:
        print(x,y,h)
        exit()


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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

ll get(ll x, ll y) {
  return (x / y);
}

int main() {
  int n, y; read(n, y);
  for(int i = 0; i <= n; i++) {
    for(int j = 0; j <= n; j++) {
      if(i + j > n) continue;
      int total = i * 10000 + j * 5000;
      if(total > y) continue;
      int need = y - total;
      if(need % 1000) continue;
      if(i + j + (need / 1000) != n) continue;
      print(i, j, need / 1000);
      return 0;
    }
  }
  print(-1, -1, -1);
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
n = int(input())
cnt = [0]*10000
sum = []
for i in range(2, n + 1):
    sum += prime_factorize(i)

for x in sum:
    cnt[x] += 1
ans = 1
for i in range(len(cnt)):
    if cnt[i] > 0:
        ans *= (cnt[i]+1)
print(ans % MOD)

Measured memory_bytes: 9044
#include<stdio.h>
int main(){
  int b,c,d,i,j,k,e,f=0,g=0;

  scanf("%d",&b);
  int a[b];
  for(k=0;k<b;k++){
    scanf("%d",&a[k]);
  }

  for(i=0;i<b-1;i++){
    c=a[i];
    d=i;
    for(j=i+1;j<b;j++){
      if(a[j]<c){
	c=a[j];
	d=j;
      }
    }
    if(a[i]!=c){
    e=a[i];
    a[i]=a[d];
    a[d]=e;
    f++;
    }
 
  }
   for(k=0;k<b-1;k++){
      printf("%d ",a[k]);
  }
    printf("%d\n",a[b-1]);
    printf("%d\n",f);
    return 0;
}
  



Measured memory_bytes: 2108
package main

import "fmt"

func main() {
	var R, G, B, N int
	fmt.Scan(&R, &G, &B, &N)

	count := 0
	for r := 0; r*R <= N; r++ {
		for g := 0; r*R+g*G <= N; g++ {
			if (N-r*R-g*G)%B == 0 {
				count++
			}
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
S = input()
S_list = list(S)

ans_list = []
for i in range(len(S)):
    ans_list.append(int(''.join(S_list[i:i+3])))

import numpy as np


def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

print(abs(753-getNearestValue(ans_list, 753)))

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int count = 0;
  for(int i = a; i <= b; i++){
    if(c % i == 0){
      count++;
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 3116