akhauriyash/Code-Regression huggingface dataset:
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
lld p1=1e9 + 7,p2=998244353;

void judge(){
    #ifndef ONLINE_JUDGE
    // for getting input from input.
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    
}

void fastio(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[5005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=5005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }


lld l,r,mid,ans=0;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;

lld ss=1;

void solve()
{ 
    cin>>x;
    cout<<(1-x);
}

int main()
{
    // judge();
    fastio();
    lld t=1;
    // cin>>t;
    // lld p1 = 1e9 + 7;
    // getfac(p1);
    for(int i=0;i<t;i++)
    {
        // cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);
ll mod = 1e9+7;

long long modpow(long long a, int p) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    int halfP = p / 2;
    long long half = modpow(a, halfP);
    return half * half % mod;
  } else {
    return a * modpow(a, p-1) % mod;
  }
}

long long modComb(int a, int b) {
  if (b > a - b) return modComb(a, a-b);

  long long ansMul = 1, ansDiv = 1;
  for (int i = 0; i < b; i++) {
    ansMul *= a - i;
    ansDiv *= i + 1;
    ansMul %= mod;
    ansDiv %= mod;
  }

  long long ans = ansMul * modpow(ansDiv, mod-2) % mod;

  return ans;
}


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

  ll ans = 0LL;
  for (int na = 0; 2 * na <= Y; na++) {
    int nb = Y - 2 * na;
    if ((na+2*nb) == X) {
      ans += modComb(na+nb, nb);
    }
    ans %= mod;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a[100];
int main() {
    long long k;
    scanf("%lld", &k);
    if (k <= 2e16) {
        printf("2\n");
        a[0] = a[1] = k / 2 + 1;
        if (k % 2 == 1) {
            a[0] += 2;
            a[1]--;
        }
        printf("%lld %lld\n", a[0], a[1]);
    }
    else {
        printf("50\n");
        k += 49 * 50;
        for (int i = 0; i < 50; i++) a[i] = k / 50;
        int pos = (k % 50) / 10;
        for (int i = 0; i < pos; i++) {
            for (int j = 0; j < 10; j++) {
                a[i] += 50;
                for (int k = 0; k < 50; k++) {
                    if (i == k) continue;
                    a[k]--;
                }
            }
        }
        for (int i = 0; i < k % 10; i++) {
            a[pos] += 50;
            for (int k = 0; k < 50; k++) {
                if (k == pos) continue;
                a[k]--;
            }
        }
        for (int i = 0; i < 50; i++) printf("%lld%c", a[i], i == 49 ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 256
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int dp[110][10010]={}; //[v][w]

int main() { 
    int n;
    cin>>n;
    VI a(n);
    rep(i,n) cin>>a[i];

    VI b(n);
    rep(i,n){
        b[a[i]-1]=i+1;        
    }
    rep(i,n) {
        cout<<b[i];
        if(i==n-1) cout<<"\n";
        else cout<<" ";
    }
}



Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF = 2e9
#define LINF = 1e18
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << "=" << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO")
#define Yes(n) cout << ((n) ? "Yes" : "No")
#define PI 3.141592653589793

int main(){

    double a, b, h, m;
    cin >> a >> b >> h >> m;

    double fun = m*6;
    double ji = (60*h+m)/2; 

    double kak = abs(fun-ji);

    cout << setprecision(11) << sqrt(a*a + b*b - 2*a*b*cos(kak*PI/180)) << endl;

}

Measured memory_bytes: 4292
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

const int INF = 100000000;

int main() {
	int N;
	cin >> N;
	rep(i, N) {
		string s1, s2;
		cin >> s1 >> s2;
		int n = s1.size();
		int m = s2.size();
		vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
		dp[0][0] = 0;
		for(int i = 1; i <= n; ++i) {
			for(int j = 1; j <= m; ++j) {
				if(s1[i-1] == s2[j-1]) {
					dp[i][j] = dp[i-1][j-1] + 1;
				} else {
					dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
				}	
			}
		}
		cout << dp[n][m] << endl;
	}
	return 0;
}

Measured memory_bytes: 5040
s = list(str(input()))

if len(set(s)) == 1:
    print(0)
    exit()

import copy
ans = 101
for i in range(26):
    c = chr(i+ord('a'))
    t = copy.copy(s)
    cnt = 0
    while True:
        temp = []
        cnt += 1
        for j in range(len(t)-1):
            if t[j] == c:
                temp.append(t[j])
            elif t[j+1] == c:
                temp.append(t[j+1])
            else:
                temp.append(t[j])
        t = copy.copy(temp)
        if len(set(t)) == 1:
            break
    ans = min(ans, cnt)
print(ans)


Measured memory_bytes: 9176
K = int(input())

if K % 7 == 0:
    K //= 7

L = 9 * K

if L % 2 == 0 or L % 5 == 0:
    ans = -1
else:
    ans = 0
    R = 10
    while 1:
        ans += 1
        if R % L == 1:
            break
        else:
            R = (10 * R) % L

print(ans)

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=3e18;
const int32_t LOG=21;
const int MOD=MOD2;

int a[3005];
int dp[3005][3005];
int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      { 
            int n,s;
            cin>>n>>s;
            rep(i,1,n+1)cin>>a[i];
            if(a[1]<s)
            dp[1][a[1]]=1;            
            rep(i,2,n+1)
            {
                 rep(j,0,s+1)
                 {
                    if(a[i]==j){dp[i][j]=(i+dp[i-1][j])%MOD;continue;}
                    if(j-a[i]>0)
                    dp[i][j]=(dp[i-1][j]+dp[i-1][j-a[i]])%MOD;
                    else
                    dp[i][j]=dp[i-1][j];
                 }
            }
            int ans=0;
            rep(i,1,n+1)
            {
                  ans+=dp[i][s];
                  ans%=MOD;
            }
            cout<<ans<<endl;  
      } 
      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 70656
N = int(input())
Tasks = [0]*N
for i in range(N):
    A,B = map(int,input().split())
    Tasks[i] = (B,A)

Tasks.sort()
s = 0
for B,A in Tasks:
    s += A
    if B < s:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 29400
H, W = map(int, input().split())
cost = []
for i in range(10):
        cost.append(list(map(int, input().split())))
pos = []
for i in range(H):
    pos.append(list(map(int, input().split())))

#ワーシャルフロイドで最短距離行列を求める
def warshall(n):
    for i in range(n):
        for j in range(n):
            for k in range(n):
                cost[j][k] = min(cost[j][k], cost[j][i] + cost[i][k])

warshall(10)

ans = 0
for i in range(H):
    for j in range(W):
        use = pos[i][j]
        if use != -1:
            ans += cost[use][1]

print(ans)


Measured memory_bytes: 3444
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int K = sc.nextInt();
    sc.nextLine();
    int[] A = Arrays.stream(sc.nextLine().split(" "))
      .mapToInt(Integer::parseInt).toArray();
    int[] B = Arrays.stream(sc.nextLine().split(" "))
      .mapToInt(Integer::parseInt).toArray();
    long ans = 0;
    long a = 0;
    long bMax = 0;
    for (int i = 0; i < M; i++) bMax += B[i];
    for (int i = 0; i <= N; i++) {
      a += i == 0 ? 0 : A[i-1];
      if (a > K) break;
      for (int j = M-1; j >= 0; j--) {
        //System.out.println(bMax);
        if (a + bMax > K) {
          M--;
          bMax -= B[j];
        } else {
          ans = Math.max(ans, i+j+1);
          break;
        }
      }
      ans = Math.max(ans, i);
    }
    System.out.println(ans);
  }
  
}

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

int main() {

  int n, r;
  cin >> n >> r;

  if(n >=10) {
   cout << r << endl;
  } else {
    int tmp = 100 * (10 - n);
    cout << r + tmp << endl;
  }
}

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

int main(void){
    int n;
    scanf("%d", &n);
    char s[10001];
    scanf("%s", s);
    int i;
    for(i=0;i<strlen(s);i++){
        s[i] += n;
        if(s[i]>'Z'){
            s[i] -= 26;
        }
    }
    printf("%s\n", s);
}


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

typedef struct dice_tag{
	int num[8];
} dice_t;


void north(dice_t *dice)
{
	int tmp = dice->num[1];
	dice->num[1] = dice->num[2];
	dice->num[2] = dice->num[6];
	dice->num[6] = dice->num[5];
	dice->num[5] = tmp;
}

void south(dice_t *dice)
{
	int tmp = dice->num[1];
	dice->num[1] = dice->num[5];
	dice->num[5] = dice->num[6];
	dice->num[6] = dice->num[2];
	dice->num[2] = tmp;
}

void west(dice_t *dice)
{
	int tmp = dice->num[1];
	dice->num[1] = dice->num[3];
	dice->num[3] = dice->num[6];
	dice->num[6] = dice->num[4];
	dice->num[4] = tmp;
	
}

void east(dice_t *dice)
{
	int tmp = dice->num[1];
	dice->num[1] = dice->num[4];
	dice->num[4] = dice->num[6];
	dice->num[6] = dice->num[3];
	dice->num[3] = tmp;

}

void turnRight(dice_t *dice)
{
	int tmp = dice->num[2];
	dice->num[2] = dice->num[4];
	dice->num[4] = dice->num[5];
	dice->num[5] = dice->num[3];
	dice->num[3] = tmp;
}

int equivDice(dice_t *dice1, dice_t *dice2)
{
	if(dice1->num[1] == dice2->num[1] && dice1->num[2] == dice2->num[2] && dice1->num[3] == dice2->num[3]
	&& dice1->num[4] == dice2->num[4] && dice1->num[5] == dice2->num[5] && dice1->num[6] == dice2->num[6])
	{
		return 1;
	}
	else return 0;
}

int check_equiv_dice(dice_t *dice1, dice_t *dice2)	
{	int i;
	for(i = 0; i < 4; i++)
	{
		if(equivDice(dice1, dice2))
		{
			
			return 1;
		}

		turnRight(dice1);
	}

	
	return 0;

}

int  func1(dice_t *dice1, dice_t *dice2)
{
	int j, flag = 0;
	
	if(flag = check_equiv_dice(dice1, dice2))
	{
		return 1;
	}
	north(dice1);
	if(flag = check_equiv_dice(dice1, dice2))
	{
		return 1;
	}
	north(dice1);
	if(flag = check_equiv_dice(dice1, dice2))
	{
		
		return 1;
	}
	north(dice1);
	if(flag = check_equiv_dice(dice1, dice2))
	{
		
		return 1;
	}
	east(dice1);
	if(flag = check_equiv_dice(dice1, dice2))
	{
		return 1;
	}
	east(dice1);
	east(dice1);
	if(flag = check_equiv_dice(dice1, dice2))
	{
		return 1;
	}

	return 0;
}



int main(void)
{
	int n, flag = 1;
	scanf("%d", &n);

	dice_t dice[n+1];
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= 6; j++)
		{
			scanf("%d", &dice[i].num[j]);
		}
	}

	for(int i = 1; i <= n-1; i++)
	{
		for(int j = i+1; j <= n; j++)
		{
			flag = func1(&dice[i], &dice[j]);
			if(flag){
				printf("No\n");
				return 0;
			}
		}
	}
	
	printf("Yes\n");

	return 0;
}


Measured memory_bytes: 3148
#include<iostream>
#include<cstdio>
using namespace std;
int x;
int a[5]; 
int main()
{
	scanf("%d",&x);
	int k=0;
	while (x!=0)
	{
		a[++k]=x%10;
		x=x/10;
	}
	bool p=1;
	for (int i=1;i<=3;i++)
	if (a[i]!=a[1])
	p=0;
	if (p)
	{
		printf("Yes\n");
		return 0;
	}
	p=1;
	for (int i=2;i<=4;i++)
	if (a[i]!=a[2])
	p=0;
	if (p)
	{
		printf("Yes\n");
		return 0;
	}	
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int i = 0;
		int ans = 0;
		int ary[] = new int[x];
		for (i = 0; i < x; i++) {
			ary[i] = s.nextInt();
		}
		Set<Integer> list = new HashSet<Integer>();
		list.add(1);
		for (i = 1;;) {
			i = ary[i - 1];
			int na=list.size();
			list.add(i);
			ans++;
			if (i == 2) {
				break;
			} else if (list.size()==na) {
				ans = -1;
				break;
			}

		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 54632
#include<iostream>
using namespace std;
const int maxn=1e5+5;
int main()
{
	int n;
	scanf("%d",&n);
	int i,j;	
	int a[maxn],b[maxn]={0};
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int cnt=0;
	int t;
	for(i=0;i<n;i++){
		if(a[i]==i+1){
		t=a[i];
		a[i]=a[i+1];
		a[i+1]=t;
		cnt++;
		}
	}
	printf("%d\n",cnt);
}

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}

int N;
int sendq(int i){
  cout<<i<<endl<<flush;
  string out;
  cin>>out;
  if(out=="Vacant")exit(0);
  else if(out=="Male")return 0;
  else return 1;
}

int main(){
  cin >> N;
  unsigned int first=sendq(0),last=first,f=0,l=N;
  while(true){
    unsigned int m=(f+l)/2,mid=sendq(m);
    if((f%2==m%2&&mid!=first)||(f%2!=m%2&&mid==first)){
      l=m;last=mid;
    }else{
      f=m;first=mid;
    }
  }
  return 0;
}


Measured memory_bytes: 852
n,x,y = map(int,input().split())
dists = [0]*(n)
for i in range(1,n+1):
    for j in range(1,i):
        dists[min(i-j,abs(j-x)+1+abs(i-y))]+=1
    
for i in range(1,len(dists)):
    print(dists[i])

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  ll x[200000];
  ll y[200000];
  REP(i,n){
   cin >> x[i];
   y[i] = x[i];
  }
  ll m = n/2;
  sort(x,x+n);
  REP(i,n){
    ll num = y[i];
    if(n&1){
      if(num <= x[m]) cout << x[m+1] << endl;
      else cout << x[m] << endl;
    }else{
      if(num < x[m]) cout << x[m] << endl;
      else cout << x[m-1] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define PI 3.14159265359

int main(){
    int n; cin >> n;
    ll l0 = 2;
    ll l1 = 1;
    if(n == 0){
        cout << l0 << endl;
    }else if(n == 1){
        cout << l1 << endl;
    }else{
        ll t0 = l0;
        ll t1 = l1;
        ll result = t0 + t1;
        repr(i, 2, n+1){
            result = t0 + t1;
            t0 = t1;
            t1 = result;
        }
        cout << result << endl;
    }

    return 0;
}


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

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

  ll n1 = stoi(s.substr(0, 2));
  ll n2 = stoi(s.substr(2, 4));

  bool isYYMM = false;
  bool isMMYY = false;

  if (n1 >= 1 && n1 <= 12) {
    isMMYY = true;
  }
  if (n2 >= 1 && n2 <= 12) {
    isYYMM = true;
  }

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


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

//    #include <boost/multiprecision/cpp_int.hpp>
 #define int long long
 #define inf  1000000007
  #define  mp make_pair
  #define  pb push_back
 #define ppa pair<int,pair<int,int>>
   using namespace std;         
    int dx[4]={0,1,0,-1};
    int dy[4]={1,0,-1,0};

	int a,b,c,d;

int yaru(int sx,int sy,int gx,int gy){
	
	int d1=abs(gx-sx)+abs(gy-sy);
	
	int d2=0;
	if(sx<a){
		if(sy<b)d2+=a-sx+b-sy-1;
		else if(sy<=d) d2+=a-sx-1;
		else d2+=a-sx+sy-d-1;
	}
	else if(sx<=c){
		if(sy<b)d2+=b-sy-1;
		else if(sy<=d) d2+=0;
		else d2+=sy-d-1;
	}
	else{
		if(sy<b)d2+=sx-c+b-sy-1;
		else if(sy<=d) d2+=sx-c-1;
		else d2+=sx-c+sy-d-1;
	}
	
	if(gx<=a){
		if(gy<=b)d2+=a-gx+b-gy;
		else if(gy<=d) d2+=a-gx;
		else d2+=a-gx+gy-d;
	}
	else if(gx<=c){
		if(gy<=b)d2+=b-gy;
		else if(gy<=d) d2+=0;
		else d2+=gy-d;
	}
	else{
		if(gy<=b)d2+=gx-c+b-gy;
		else if(gy<=d) d2+=gx-c;
		else d2+=gx-c+gy-d;
	}
	return min(d1,d2);
}


int solve(){
	int n;
	cin>>n;
	if(n==0) exit(0);
	cin>>a>>b>>c>>d;
	int sx,sy;
	cin>>sx>>sy;
	int gx,gy;
	
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>gx>>gy;
		
		ans+=yaru(sx,sy,gx,gy);
		sx=gx;
		sy=gy;
	}
	
	return ans;
}



 signed main(){
 	
 
    	       cin.tie(0);
   			ios::sync_with_stdio(false);
	
 	
 	while(1){
 		cout<<solve()<<endl;
 	}
 	
 	return 0;
 
  }
 


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long inf = 100000000000000;
typedef pair<int, int> P;
int main() {
	ll l, r;
	cin >> l >> r;
	ll ans = inf;
	ll i, j;
	if (r - l >= 2019) {
		cout << 0;
		return(0);
	}
	for (i = l; i <= r-1; i++) {
		for (j = l + 1; j <= r; j++) {
			ans = min(ans, (i * j) % 2019);
		}
	}
	cout << ans;
	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  int t;
  ll n;
  cin>>n;
  string s;
  cin>>s;
  ll i;
  char x[n];ll c=0;
  for(i=0;i<n;i++)
  {
  	if(s[i]=='R')
  	c++;
  }
  for(i=0;i<c;i++)
  {
  	x[i]='R';
  }
  for(i=c;i<n;i++)
  {
  	x[i]='W';
  }
  ll ans=0;
  for(i=0;i<n;i++)
  {
  	if(s[i]!=x[i])
  	ans++;
  }
  cout<<(ans)/2<<endl;
  return 0;
}


Measured memory_bytes: 3932
#include <stdint.h>
#include <stdio.h>
using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using s8 = int8_t;
using s16 = int16_t;
using s32 = int32_t;
using s64 = int64_t;
// using float
// using double

int main() {
	s32 N;
	scanf("%d", &N);
  if( N%2 == 0){
	   printf("%.10lf\n", 0.5);
  }else{
	   printf("%.10lf\n", (N+1)/2.0/N);
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using P = pair<int, int>;
const int INF = 1001001001;
ll MOD = 1e9 + 7;

int main() {
  int N, C;
  cin >> N >> C;
  vector<vector<ll>> d(C + 1, vector<ll>(C + 1));
  for (int i = 1; i <= C; i++) {
    for (int j = 1; j <= C; j++) {
      cin >> d[i][j];
    }
  }
  vector<vector<ll>> c(3, vector<ll>(C + 1, 0));
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      ll x;
      cin >> x;
      c[(i + j) % 3][x]++;
    }
  }
  ll ans = 1000000010;
  for (int i = 1; i <= C; i++) {    // rest 0
    for (int j = 1; j <= C; j++) {  // rest 1
      if (i == j) continue;
      for (int k = 1; k <= C; k++) {  // rest 2
        if (i == k || j == k) continue;
        ll sum = 0;
        for (int l = 1; l <= C; l++) sum += c[0][l] * d[l][i];
        for (int l = 1; l <= C; l++) sum += c[1][l] * d[l][j];
        for (int l = 1; l <= C; l++) sum += c[2][l] * d[l][k];
        ans = min(ans, sum);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			int n = sc.nextInt();
			int[] a = new int[n];
			int[] b = new int[n];
			int[] c = new int[n];

			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			for (int i = 0; i < n; i++) {
				b[i] = sc.nextInt();
			}
			for (int i = 0; i < n; i++) {
				c[i] = sc.nextInt();
			}

			Arrays.sort(a);
			Arrays.sort(b);
			Arrays.sort(c);

			long ans = 0;
			for (int i = 0; i < b.length; i++) {
				int b_value = b[i];

				//b_valueより小さいaの個数を求める
				int a_index = lower_bound(a, b_value);

				//b_valueより大きいcの個数を求める
				int c_index = upper_bound(c, b_value);

				ans += (long)(a_index) * (long)(n - c_index);
			}

			System.out.println(ans);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	private static int lower_bound(int[] arr, int value) {
		int l = 0;
		int r = arr.length - 1;

		while (l <= r) {
			int pivot = l + (r - l) / 2;
			if (arr[pivot] < value) {
				l = pivot + 1;
			} else {
				r = pivot - 1;
			}
		}

		return l;
	}

	private static int upper_bound(int[] arr, int value) {
		int l = 0;
		int r = arr.length - 1;

		while (l <= r) {
			int pivot = l + (r - l) / 2;
			if (arr[pivot] <= value) {
				l = pivot + 1;
			} else {
				r = pivot - 1;
			}
		}

		return l;
	}

}


Measured memory_bytes: 64968
n = int(input())
word_list  = sorted([ sorted(input()) for v in range(n) ])
k = 1
mul_list = []


for i in range(n-1):
    if word_list[i] == word_list[i+1]:
        k += 1
    else:
        mul_list.append(k)
        k = 1
else:
    mul_list.append(k)


def com(a):
    return a*(a-1)//2

print(sum(map(com,mul_list)))

Measured memory_bytes: 102488
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

ll dp[110][5][2];

int main(){
  string S;cin>>S;
  int K;cin>>K;
  int N = (int)S.size();
  dp[0][0][0] = 1;
  rep(i,N) {
    rep(j,5) {
      int now = S[i] - '0';
      // 0 to 0
      if(now == 0) {
	dp[i+1][j][0] += dp[i][j][0];
      } else {
	dp[i+1][min(j+1,4)][0] += dp[i][j][0];
      }

      // 0 to 1
      if(now > 0) {
	dp[i+1][j][1] += dp[i][j][0];
	dp[i+1][min(j+1,4)][1] += (now - 1) * dp[i][j][0];
      }

      // 1 to 1
      dp[i+1][min(j+1,4)][1] += 9 * dp[i][j][1];
      dp[i+1][j][1] += dp[i][j][1];
    }
  }
  cout<<dp[N][K][0] + dp[N][K][1]<<endl;
}

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


#define DEBUG(x)                cout << '>' << #x << ':' << x << endl;
#define D(x)                    cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define DD(x,y)                 cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << '\n'
#define DDD(x,y,z)              cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << "   " << #z << " = " << z << '\n'
#define DBG                     cerr << __LINE__ << ": Hi" << '\n'
#define fresh                   {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
#define read                    freopen("in.txt","rt",stdin)
#define write                   freopen("out.txt","wt",stdout)
#define PI                      3.1415926535897932384626433832795
#define mems(ds_name,val)       memset(ds_name,val,sizeof(ds_name))
#define ll                      long long

set<string>S;
vector<string>V;

void run(istream& in,ostream& out){
   int n;
   in>>n;
   int flag=0;
   for(int i=0;i<n;i++){
        string str;
        in>>str;
        S.insert(str);
        V.push_back(str);
        if(i){
            if(S.size()!=V.size()){flag=1;out<<"No\n";break;}
            string s = V[i-1];
            int len = s.length();
            if(s[len-1] != str[0]){flag=1;out<<"No\n";break;}
        }
   }
   if(flag==0)out<<"Yes\n";
}


int main()
{
    fresh;
//    read;
//	write;
    run(cin,cout);
    return 0;
}



Measured memory_bytes: 256
n, m = map(int, input().split())
s = set(int(input()) for _ in range(m))

MOD = 10 ** 9 + 7

dp = [0] * (n + 1)
dp[0] = 1

for i in range(1, n + 1):
    if i in s:
        continue
    x = dp[i - 1]
    if i > 1:
        x += dp[i - 2]
    dp[i] = x % MOD

print(dp[n])


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

namespace {
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define len(x) (int)((x).size())
#define X first
#define Y second

#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
  
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;

ll expmod(ll a,ll b,ll mod) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
template<typename T> T sqr(const T& x) { return x*x; }
ll flog(const ll x) { return 63 - __builtin_clzll(x); }
template<typename T> void sort(T& t) { sort(all(t)); }
template<typename T> void undupe(vector<T>& v) { sort(v); v.erase(unique(all(v)), v.end()); }

struct _IOS { _IOS() { ios::sync_with_stdio(0); cin.tie(0); } } _IOS;
}

const ll MOD = 1000000009LL;
const ll INF = 1e15;
const double EPS = 1e-8;

int solve(string s, char c) {
  int ans = 0;
  while (count(s.begin(), s.end(), c) != s.size()) {
    ans++;
    for (int i=0; i<(int)s.size()-1; i++) {
      if (s[i+1] == c) s[i] = c;
    }
    s.pop_back();
  }
  return ans;
}

int main() {
	string s;
	cin >> s;
	
	int ans = INT_MAX;
	for (char c='a'; c<='z'; c++) {
	  ans = min(ans, solve(s, c));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int dp[8192][15], power[16], n, m, a, b, c, t, f[15][15], sum[8192], sum2[8192][15];
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a >> b >> c; a--; b--;
		if (a == 0)a = n - 2; else if (a == n - 1)a = n - 1; else a--;
		if (b == 0)b = n - 2; else if (b == n - 1)b = n - 1; else b--;
		f[a][b] = c; f[b][a] = c; t += c;
	}
	n -= 2; power[0] = 1; for (int i = 1; i < 16; i++)power[i] = power[i - 1] * 2;
	for (int i = 0; i < power[n]; i++) { for (int j = 0; j <= n + 1; j++)dp[i][j] = -1; dp[i][n] = 0; }
	
	for (int i = 0; i < power[n]; i++) {
		vector<int>R;
		for (int j = 0; j < n; j++) { if ((i / (1 << j)) % 2 == 1)R.push_back(j); }
		for (int j = 0; j < R.size(); j++) { for (int k = j + 1; k < R.size(); k++)sum[i] += f[R[j]][R[k]]; }
		for (int k = 0; k <= n + 1; k++) {
			for (int j = 0; j < R.size(); j++)sum2[i][k] += f[R[j]][k];
		}
	}
	for (int i = 0; i < power[n]; i++)dp[i][n] = sum[i] + sum2[i][n];
	for (int i = 0; i < power[n]; i++) {
		for (int j = 0; j < n + 1; j++) {
			if (dp[i][j] == -1)continue;
			for (int k = 0; k <= n + 1; k++) {
				if ((i / (1 << k)) % 2 == 1 || k == n)continue;
				int c1 = f[j][k]; if (f[j][k] == 0)continue;
				vector<int>R; int s = i; if (k < n)s += (1 << k);
				for (int l = 0; l < n; l++) { if ((s / (1 << l)) % 2 == 0)R.push_back(l); }

				for (int l = 0; l < power[R.size()]; l++) {
					int V = 0; for (int o = 0; o < R.size(); o++) { if ((l&(1 << o)) != 0)V += (1 << R[o]); }
					int c2 = c1 + sum[V] + sum2[V][k];
					dp[s + V][k] = max(dp[s + V][k], dp[i][j] + c2);
				}
			}
		}
	}
	int maxn = 0;
	for (int i = 0; i < power[n]; i++) {
		if (dp[i][n + 1] == -1)continue;
		vector<int>R;
		for (int j = 0; j < n; j++) { if ((i / (1 << j)) % 2 == 0)R.push_back(j); }
		for (int j = 0; j < R.size(); j++) { for (int k = j + 1; k < R.size(); k++)dp[i][n + 1] += f[R[j]][R[k]]; }
		maxn = max(maxn, dp[i][n + 1]);
	}
	cout << t - maxn << endl;
	return 0;
}

Measured memory_bytes: 1280
def main():
    N = int(input())
    p = list(map(int, input().split()))
    ans = []

    sc = 1 #score count
    for _ in range(N):
        cnt = 0
        for i in range(len(p)):
            if p[i] >= sc:
                cnt += 1
        if cnt >= sc:
            ans.append(sc)
        sc += 1

    ans.sort(reverse = True)
    print(ans[0])


if __name__ == "__main__":
    main()

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



//defines...
#define ll  long long
#define tata return;
#define pb push_back
#define mp make_pair
#define in insert
#define run ios_base::sync_with_stdio(false);cin.tie(NULL);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define vec vector<ll>
#define setl set<ll>
#define mapl map<ll,ll>
#define shunno cout<<0<<endl;
#define pi 2*acos(0.0)1
#define hobena cout<<-1<<endl;




//typedefs...
typedef pair<ll,ll>pll;

//const..
//const ll fx[]={0,1,0,-1};
//const ll fy[]={1,0,-1,0};
const ll mod=1e9+7;


//......Algo.....

/*ll ncr(ll n, ll k)
{
    ll res = 1;


    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
*/
//to remove suffix of a number from a set of string
/*
for(int k=1; k<j.size(); k++)
                if(temp.count(string(j.begin()+k,j.end())))
					temp.erase(string(j.begin()+k,j.end()));
 */
ll bigmod(ll base ,ll power,ll mod)
{
    if(power==0) return 1;
    else if(power%2)
    {
        ll p1=base%mod;
        ll p2=(bigmod(base,power-1,mod))%mod;
        return (p1*p2)%mod;
    }
    else
    {
        ll p=(bigmod(base,power/2,mod)%mod);
        return (p*p)%mod;
    }
}

void oka()
{
   ll L,R,i,j,d;
   cin>>L>>R>>d;
   ll cnt=0;
   for(i=L;i<=R;i++)
   {
       if(i%d==0)
        cnt++;
   }
   cout<<cnt<<endl;

}
/*I'll paint it on the walls
     cause I'm the one at fault
    I'll never fight again and
         this is how it ends .*/






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

    run
    ll t;
   t=1;
  //cin>>t;
    while(t--){

    oka();
    }



}



Measured memory_bytes: 3608
"use strict"
// inputに入力データ全体が入る
function Main(input){
    let result = 0
    input.split("").forEach(e=>{
        if(e=="+") result++;
        if(e=="-") result--;
    });
    console.log(result)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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


int main(){
	int N, D;
	cin >> N >> D;
	vector<vector<int>> X(N, vector<int>(D));
	rep(i, N){
		rep(j, D) {
			cin >> X[i][j];
		}
	}
	int ans = 0;
	for(int i = 0; i < N - 1; ++i){
	   for(int j = i + 1; j < N; j++){
		   int tmp = 0;
	   		rep(k, D) {
		 		tmp += (X[i][k] - X[j][k])	* (X[i][k] - X[j][k]);
			}
		rep(l,128) {
		if(l*l == tmp) ans++;
		}
	   }
	}	   
	cout << ans << endl;
	return 0;
}














Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int n,k,dp[100009][3],a[100009][3],mx=1e9+8;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)cin>>a[i][j];
    }
    for(int i=0;i<3;i++)dp[0][i]=a[0][i];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(k==j)continue;
                dp[i][j]=max(dp[i][j],dp[i-1][k]);
            }
            dp[i][j]+=a[i][j];
        }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}


Measured memory_bytes: 2560
// J'aime
// Chemise Blanche

#include <bits/stdc++.h>
using namespace std;

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3652
#include<iostream>
using namespace std;
int main(){
	int x,y,a,b,c,d;
	cin>>a>>b>>c>>d;
	x=a+b+c+d;
	cin>>a>>b>>c>>d;
	y=a+b+c+d;
	if(x>y)
	cout<<x<<endl;
	else
	cout<<y<<endl;
	return 0;
}

Measured memory_bytes: 0
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=4000
etem4=1
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(1)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[day-i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    #print(score)
for i in solution:
  print(i+1)
#print(sco)


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

int main() {
  int N;
  cin>>N;

  vector<int> x(N);
  for(int i=0;i<N;i++) cin>>x[i];
  long ans=1234567890000;
  for(int i=1;i<=100;i++){
    long tmp=0;
    for(int j=0;j<N;j++){
      tmp+= (i-x[j])*(i-x[j]);
    }
    ans=min(ans,tmp);
  }
cout<<ans<<endl;

}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
	string s;
	cin>>s;
	long long ans=0;
	for(int t=0;t<(1<<(s.size()-1));t++)
	{
		long long num=s[0]-'0';
		for(int i=0;i<s.size()-1;i++)
		{
			if(t&(1<<i))
			{
				ans+=num;
				num=0;
			}
			num=num*10+s[i+1]-'0';
		}
		ans+=num;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    int K = scanner.nextInt();
    int[] a = new int[]{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};
    System.out.println(a[K - 1]);
  }
}


Measured memory_bytes: 23124
#include<stdio.h>
int main()
{
	char s[20], t[20];
	scanf("%s%s", s, t);
	int i;
	for (i = 0; s[i] != '\0'; i++)
	{
		if (s[i] != t[i])
		{
			printf("No\n");
			return 0;
		}
	}
	if (t[i + 1] != '\0')
		printf("No\n");
	else
		printf("Yes\n");
	return 0;
}

Measured memory_bytes: 1648
N, K = [int(i) for i in input().split()]
S = input()
last = S[0]
ls = []
cnt = 0
flg = 0
for n in range(N):
    if S[n] == last:
       cnt += 1
       flg = 1
    else:
        ls.append(cnt)
        last = S[n]
        cnt += 1
        flg = 0
if flg == 1:
    ls.append(cnt)
cumsum = []
ls = [0] * 2 * K + ls
ls_len = len(ls)
first = 0 if S[0] == "0" else 1
for _n in range(first, len(ls), 2):
    cumsum.append(ls[min(ls_len-1, _n + K * 2 + 1)] - ls[_n])
print(max(cumsum))

Measured memory_bytes: 10484
import sys


def main():
    m, d = [int(s) for s in sys.stdin.readline().strip().split()]

    ans = 0
    for month in range(1, m+1):
        for day in range(22, d+1):
            if (day % 10) > 1 and (day // 10) > 1:
                if (day % 10) * (day // 10) == month:
                    ans += 1
    print(ans)


main()


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

int cnt[100];
int main(){
    int n,ma=0;

    while(cin>>n)ma=max(ma,++cnt[--n]);

    for(int i=0;i<100;i++)
        if(cnt[i]==ma)cout<<i+1<<endl;

   return 0;
}

Measured memory_bytes: 1160
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 0;
        for(int i=0;i<N;i++){
            int l = sc.nextInt();
            int r = sc.nextInt();
            ans += r-l+1;
        }
        System.out.println(ans);
    }

    public static void main(String[] args) {
        new Main();
    }
}


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

int main(){
  string str1, str2;
  while(cin >> str1 >> str2){
    int ans=0;
    for(int i=0;i<str1.length();i++){
      string temp=str1.substr(i, str1.length()-i);
      int count=0;
      for(int j=0;j<min(temp.length(), str2.length());j++){
	if(temp[j]==str2[j]) count++;
	else count=0;
	ans=max(ans, count);
      }
    }
    for(int i=0;i<str2.length();i++){
      string temp=str2.substr(i, str2.length()-i);
      int count=0;
      for(int j=0;j<min(temp.length(), str1.length());j++){
	if(temp[j]==str1[j]) count++;
	else count=0;
	ans=max(ans, count);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 932
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Long[] a = new Long[n + 1];
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextLong();
		}
		long max = 0;
		long ans = 0;
		for(int i = 0 ; i < n ; i++) {
			if(max > a[i]) {
				ans += max - a[i];
			}
			if(max < a[i]) {
				max = a[i];
			}
		}
		sc.close();
		System.out.println(ans);

	}
}



Measured memory_bytes: 64272
import java.io.FilePermission;
import java.util.Arrays;
import java.util.Scanner;

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

        Bingo bingo = new Bingo();
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                bingo.setData(i, j, sc.nextInt());
            }
            sc.nextLine();
        }
        int N = sc.nextInt();
        boolean FLG = false;
        for(int i=0;i<N;i++){
            int b =  sc.nextInt();
            sc.nextLine();

            for(int j=0 ; j<3 ; j++){
                for(int k=0 ; k<3 ; k++){
                    if(bingo.getData(j, k) == b){
                        bingo.setHit(j, k);
                    }
                }
            }
            for(int j=0; j<3; j++){
                if(bingo.checkVertical(j) || bingo.checkCross(j)){
                    FLG = true;
                    break;
                }
            }
            if(bingo.checkDiagonal()) FLG = true;
            if(FLG) break;
        }
        if(FLG){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        sc.close();
    }
}
class Bingo{
    private int data[][];
    private boolean hit[][];
    Bingo(){
        this.data = new int[3][3];
        hit = new boolean[3][3];
        for(boolean[] row: hit) Arrays.fill(row, false);
    }
    void setData(int i, int j, int value){
        data[i][j] = value;
    }
    int getData(int i, int j){
        return data[i][j];
    }
    void setHit(int i, int j){
        hit[i][j] = true;
    }   
    boolean getHit(int i, int j){
        return hit[i][j];
    }
    boolean checkVertical(int index){
        if(hit[index][0] && hit[index][1] && hit[index][2]) return true;
        return false;
    }
    boolean checkCross(int index){
        if(hit[0][index] && hit[1][index] && hit[2][index])return true;
        return false;
    }
    boolean checkDiagonal(){
        if(hit[0][0] && hit[1][1] && hit[2][2])return true;
        if(hit[0][2] && hit[1][1] && hit[2][0])return true;
        return false;
    }
}

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

int main() {
    int n,a;
    cin>>n;
    int tw,fo,ot;
    tw=fo=ot=0;
    for (int i=0;i<n;i++) {
        cin>>a;
        if (a%4==0)
            fo++;
        else if (a%2==0)
            tw=1;
        else
            ot++;
    }
    ot+=tw;
    if (ot<=fo+1)
        puts("Yes");
    else
        puts("No");
    return 0;
}

Measured memory_bytes: 384
from operator import itemgetter
import math

#(基本方針)最初にbi(>max(ai))与えて,残りはmax(ai)で攻撃
#->bi与えてaiをp回与える = aiをp回与えてbi与える(ただし,ai*p < H-bi )
N,H = map(int,input().split())
sord = []
max_a = 0
for i in range(N):
 a,b = map(int,input().split())
 max_a = max(max_a,a)
 sord.append([a,b])
sord = sorted(sord, key=itemgetter(1) , reverse = True)

count = 0
for i in range(N):
  if(sord[i][1] >= max_a):
   #max_aより攻撃力のあるbiで攻撃
   H = H - sord[i][1]
   count += 1
   if(H <= 0):
    H = 0
    break

#残りHPをmax_aで与える
count += math.ceil(H/max_a)
print(count)

Measured memory_bytes: 21964
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;
 
int main(){
  double r;
  cin >> r;
  cout << 2*r*3.1415 << endl;
 
}

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

using namespace std;

#define PI 3.1415926535897932

int main(){
    int n,m;
    char s[10];
    long long tmp=0,ans=0;
    scanf("%s",s);
    for (int i=0;i<(1<<(strlen(s)-1));i++) {
        tmp=(s[0]-'0');
        for (int j=0;j<(strlen(s)-1);j++) {
            if (i & (1<<j)) {
                tmp*=10;
                tmp+=(s[j+1]-'0');
            } else {
                ans+=tmp;
                tmp=(s[j+1]-'0');
            }
        }
        ans+=tmp;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
#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 a, b;
  cin >> a >> b;
  int ans = a;
  if (b < a) {
    ans--;
  }

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


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int& i : a) cin >> i;
    int x = reduce(a.begin(), a.end(), 0, bit_xor<int>());
    for(int i : a) cout << (i ^ x) << ' ';
}

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

int main() {
    int n;
    cin >> n;
    vector<int> b(n-1);
    rep(i, n-1) cin >> b[i];
    
    int ans = b[0];
    rep(i, n-2) ans += min(b[i], b[i+1]);
    cout << ans + b[b.size()-1] << endl;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	string a; cin >> a;
	
	vl cnt(26);
	for (char c: a) cnt[c-'a']++;
	
	ll res = 1;
	FOR(i,0,26) res = res * (1 + cnt[i]) % MOD;
	res = (res + MOD-1) % MOD;
	cout << res << endl;
}



Measured memory_bytes: 512