akhauriyash/Code-Regression huggingface dataset:
#include<stdlib.h>
#include<stdio.h>
#include<string.h>


int main()
{
    char a[10];
    gets(a);
    int i;
    for(i = 0;i<10;i++)
    {
        if(a[i] == '\0')
            break;
    }
    if(i == 3)
    {
        for(i = 0;i<3;i++)
        {
            printf("%c",a[2-i]);
        }
    }
    if(i == 2)
    {
        for(i = 0;i<2;i++)
        {
            printf("%c",a[i]);
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const double PI=3.14159265358979323846;

int main(){
  int n; string s;
  cin >> n >> s;
  int ans = 1;
  char c = s[0];
  for(int i = 1; i < n; i++){
    if(c != s[i]){
      c = s[i];
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<P> a;
  if(n%2){
    REP(i,1,n) a.emplace_back(i,n);
    n--;
  }
  REP(i,1,n/2)REP(j,i+1,n/2+1){
    a.emplace_back(i,j);
    a.emplace_back(i,n-j+1);
    a.emplace_back(n-i+1,j);
    a.emplace_back(n-i+1,n-j+1);
  }

  int m = a.size();
  cout << m << endl;
  rep(i,m){
    cout << a[i].F << " " << a[i].S << endl;;
  }
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	
	int answer = 0;
	for (int i = 0; i < N; i++)
	{
		// 3倍操作は何回でもできるので、2で割る操作を1回行った回数を計算する
		while(A[i] % 2 == 0)
		{
			A[i] /= 2;
			answer++;
		}
	}
	
	cout << answer << endl;
	
	return 0;
}

Measured memory_bytes: 256
n,a,b,k=map(int,input().split())
mod=998244353
f=[1]
for i in range(n):f+=[f[-1]*(i+1)%mod]
def comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod
ans=0
for ac in range(k//a+1):
  asum=ac*a
  if (k-asum)%b:continue
  bc=(k-asum)//b
  if max(ac,bc)>n:continue
  ans=(ans+comb(n,ac)*comb(n,bc))%mod
print(ans)

Measured memory_bytes: 60944
#include<stdio.h>
int main(void){
	int a,b;
	char OP;
	while(1){
		scanf("%d %c %d",&a,&OP,&b);
		if(OP=='+'){
			printf("%d\n",a+b);
		}
		if(OP=='-'){
			printf("%d\n",a-b);
		}
		if(OP=='*'){
			printf("%d\n",a*b);
		}
		if(OP=='/'){
			printf("%d\n",a/b);
		}
		if(OP=='?'){
			break;
		}
	}
	return 0;
}

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

#define N 26
#define NIL -1

//array
int parent[N];
int leftc[N];
int rightc[N];

int sibling[N];
int degree[N];
int depth[N];
int height[N];

int root;


//calculate depth
void caldepth(int now,int down){
  // printf("%d %d\n", now, down);

  if(rightc[now]==NIL && leftc[now]==NIL){
    
    
    return; 
  }
  
  depth[down]=depth[now]+1;
 
  
  if(leftc[now]!=NIL) caldepth(leftc[now],leftc[leftc[now]]);
  if(leftc[now]!=NIL) caldepth(leftc[now],rightc[leftc[now]]);
  if(rightc[now]!=NIL) caldepth(rightc[now],leftc[rightc[now]]);
  if(rightc[now]!=NIL) caldepth(rightc[now],rightc[rightc[now]]);
  
}

//calculate height
void calheight(int now,int up){
  if(parent[now]==NIL){
    return;
  }
  else if(height[up]<height[now]+1){
    height[up]=height[now]+1;
    calheight(up,parent[up]);
  }

 
  

}


int main(){

  int i,j,id,n,child1,child2;

  //load data
  scanf("%d",&n);
  
  //initialize
  for(i=0;i<N;i++){
    parent[i]=NIL;
    leftc[i]=NIL;
    rightc[i]=NIL;
    sibling[i]=NIL;
    degree[i]=0;
    depth[i]=0;
    height[i]=0;
  }

  for(i=0;i<n;i++){
    
    //load data
    scanf(" %d %d %d",&id,&child1,&child2);

    //set parent
    parent[child1]=id;
    parent[child2]=id;
    
    //set left right
    leftc[id]=child1;
    rightc[id]=child2;
    
    //set sibling
    sibling[child1]=child2;
    sibling[child2]=child1;

    //set degree
    if(child1!=NIL){
      degree[id]++;
      depth[child1]++;
    }
    if(child2!=NIL){
      degree[id]++;
   
    }

  }
  //find root
  for(i=0;i<n;i++){
    if(parent[i]==NIL){
      root=i;
      break;
    }
  }

  //test
  /*for(i=0;i<n;i++){
    printf("%d %d %d\n", i, leftc[i], rightc[i]);
    }*/
  //calculate depth
  if(leftc[root]!=NIL){
    caldepth(root,leftc[root]);
  }
  if(rightc[root]!=NIL){
    caldepth(root,rightc[root]);
  }
  
  //find leaf & calculateheight
  for(i=0;i<n;i++){
    if(leftc[i]==NIL && rightc[i]==NIL){
      calheight(i,parent[i]);
    }
  }

  
  //print
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,parent[i],sibling[i],degree[i],depth[i],height[i]);

    if(parent[i]==NIL)printf("root");
    else if(leftc[i]==NIL&&rightc[i]==NIL)printf("leaf");
    else if(leftc[i]!=NIL ||rightc[i]!=NIL)printf("internal node");

    printf("\n");
  }
  
  
  return 0;
}

//I was tired.

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void){
    char s[1020];
    scanf("%s",s);
    int w;
    scanf("%d",&w);
    for (int i=0; i<strlen(s); i++){
        if(i%w==0){
            printf("%c",s[i]);
        }
    }
    printf("\n");
	return 0 ;
}

Measured memory_bytes: 128
// Last Change:                              11/24/2018 02:30:29.
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <list>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define INFTY 1000000010
int countNum;
int L[250005];
int R[250005];

void Merge(int A[], int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  for (int i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  for (int i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  int i = 0;
  int j = 0;
  for (int k = left; k < right; k++) {
    if (L[i] <= R[j]) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
    countNum++;
  }
}

void MergeSort(int A[], int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    MergeSort(A, left, mid);
    MergeSort(A, mid, right);
    Merge(A, left, mid, right);
  }
}

int main() {
  int N, A[500000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  MergeSort(A, 0, N);
  for (int i = 0; i < N; i++) {
    if (i) {
      cout << " ";
    }
    cout << A[i];
  }
  cout << endl;
  cout << countNum << endl;
}




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

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

const int INF = 1000000007;

int main(void){
	int n, m; cin>>n>>m;
	vector<int> vec;
	int x[100010] = {0};
	for(int i=0;i<m;i++)cin>>x[i];

	sort(x, x+m);

	for(int i=0;i<m - 1;i++) {
		int elm = 0; 
		elm = x[i + 1] - x[i];
		vec.push_back(elm);
	}

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

	ll ans = 0;
	for(int i=0;i<m - n;i++) {
		ans += vec[i];
	}

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

Measured memory_bytes: 1276
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Char8 as B
import Data.Bool
import Data.Maybe

main :: IO ()
main = B.interact $ solve . readQuery . tail . map (fst . fromJust . B.readInt) . B.words

readQuery :: [Int] -> [(Int, Int, Int)]
readQuery [] = []
readQuery (t:x:y:as) = (t, x, y) : readQuery as

solve :: [(Int, Int, Int)] -> B.ByteString
solve qs = bool "No" "Yes" $ all p $ zipWith op qs ((0,0,0):qs)
  where
    op (t, x, y) (u, z, w) = t - u - (abs (x - z)) - (abs (y - w))
    p n = n >= 0 && even n





Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;

	if(a<b && a<c){
		if((a+b)<(a+c))
			cout<<a+b;
		else
			cout<<a+c;
	}else if(b<a && b<c){
		if((b+a)<(b+c))
			cout<<b+a;
		else
			cout<<b+c;
	}else if(c<a && c<b){
		if((c+a)<(c+b))
			cout<<c+a;
		else
			cout<<c+b;
	}else
		cout<<a+a;
	return 0;
}

Measured memory_bytes: 256
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll a,b,ans=0;
  cin>>a>>b;
  ll n=0;
  ans=max(n,a-2*b);
  cout<<ans<<endl;
}


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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1e9+7;

int main() {
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	bool dp[f+1][f+1];
	for(int i=0;i<f+1;i++){
		for(int j=0;j<f+1;j++){
			dp[i][j]=false;
		}
	}
	pair<ll,ll> ans={0,0};
	double ma=0;
	dp[0][0]=true;
	for(int i=0;i<f+1;i++){
		for(int j=0;j<f+1;j++){
			if(i+100*a+j < f+1&&dp[i][j]){
				dp[i+100*a][j]=true;
				if(ans.first*j>=ans.second*(i+100*a)){
					ans={i+100*a,j};
				}
			}
			if(i+100*b+j < f+1&&dp[i][j]){
				dp[i+100*b][j]=true;
				if(ans.first*j>=ans.second*(i+100*b)){
					ans={i+100*b,j};
				}
			}
			if(i*e>=100*(j+c)&&i+j+c<f+1&&dp[i][j]){
				dp[i][j+c]=true;
				if(ans.first*(j+c)>=ans.second*i){
					ans={i,j+c};
				}
			}
			if(i*e>=100*(j+d)&&i+j+d<f+1&&dp[i][j]){
				dp[i][j+d]=true;
				if(ans.first*(j+d)>=ans.second*i){
					ans={i,j+d};
				}
			}
		}
	}
	cout<<ans.first+ans.second<<" "<<ans.second<<endl;
}

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

int f(ll x, ll y){
	int ans = 0;
	ll z = max(x, y);
	while(0 < z){
		z /= 10;
		ans++;
	}
	return ans;
}
	int main(){
	ll n;
	cin >> n;
	int ans = f(n,1);
	for(ll i = 1; i*i <= n; i++){
		if(n%i == 0){
			ll p = n/i;
			ans = min(ans, f(i, p));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int r;
    cin >> r;
    cout << r * r << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

ll lastdisit(ll n)
{
	ll m=n;
	while(n>=10)
	{
		n/=10;
	}
	return n;
}

int main()
{
	ll n;
	cin >> n;
	vector<vector<ll>> lr(10,vector<ll>(10,0));
	for(ll i=1;i<=n;i++)
	{
		if(i%10==0)
		{
			continue;
		}
		lr[lastdisit(i)-1][i%10-1]++;
	}
	ll ans = 0;
	rep(i,10)
	{
	rep(j,10)
	{
		//cout<<lr[i][j];
		ans += lr[i][j]*lr[j][i];
	}//cout<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <stdio.h>
using namespace std;
double a,b,c;//ax+by+c=0
double x[4],y[4];//p,1,2,3
void make_line(double x1,double y1,double x2,double y2){
    if(x1!=x2&&y1!=y2){
        a=(y1-y2)/(x1-x2);
        b=-1;
        c=-a*x1+y1;
    }else if(x1==x2){
        a=1;
        b=0;
        c=-x1;
    }else if(y1==y2){
        a=0;
        b=1;
        c=-y1;
    }
    return;
}
bool check(int p,int q,int r){//whether the point is r side or not
    make_line(x[p],y[p],x[q],y[q]);//line pq
    if((a*x[r]+b*y[r]+c)*(a*x[0]+b*y[0]+c)<=0)return false;
    return true;
}
 
int main()
{
	char c;
    while(cin>>x[1]>>c>>y[1]>>c>>x[2]>>c>>y[2]>>c>>x[3]>>c>>y[3]>>c>>x[0]>>c>>y[0]){
        bool ans=true;
        ans&=check(1,2,3);
        ans&=check(2,3,1);
        ans&=!check(3,1,2);
        printf(ans?"YES\n":"NO\n");
    }
    return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;

#ifdef LOCAL
    #define debug(v) cerr<<v<<"\n"
#else
    #define debug(...) 42
#endif
#define out(v) cout<<v<<"\n"
#define _overload3(_1,_2,_3,name,...) name
#define _all1(a) (a).begin(),(a).end()
#define _all2(a,n) (a),(a)+n
#define all(...) _overload3(__VA_ARGS__,42,_all2,_all1,)(__VA_ARGS__)
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
const int MOD = 1e9+7;
const int INF = 1e9;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>ostream& operator<<(ostream& os, vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& out,const pair<T1,T2>& rhs){out<<"("<<rhs.first<<", "<<rhs.second<<")";return out;}
#include<type_traits>
template<typename T,size_t SIZE,enable_if_t<!is_same<remove_cv_t<T>,char>::value,nullptr_t> = nullptr>ostream& operator<<(ostream& os,T(&arr)[SIZE]){os<<"{";for(size_t i=0;i<SIZE;++i)os<<(i?", ":"")<<arr[i];os<<"}";return os;}

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

int sign(ll n) {
  if (n > 0)
    return 1;
  if (n < 0)
    return -1;
  return 0;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  ll T1, T2; cin >> T1 >> T2;
  ll A1, A2; cin >> A1 >> A2;
  ll B1, B2; cin >> B1 >> B2;

  ll p = T1 * (A1 - B1);
  ll q = T2 * (A2 - B2);

  if (p > 0) {
    p *= -1;
    q *= -1;
  }

  if (p + q == 0)
    out("infinity");
  else if (p + q < 0)
    out(0);
  else
    out(2*abs(p/ (p+q)) + (p % (p+q) ? 1 : 0));


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

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

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = __LONG_LONG_MAX__;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    vector<ll> t(2);
    cin >> t[0] >> t[1];
    vector<ll> a(2),b(2);
    cin >> a[0] >> a[1];
    cin >> b[0] >> b[1];
    ll x = (a[0]-b[0])*t[0];
    ll y = (a[1]-b[1])*t[1];
    if((x>0 && y>0)||(x<0 && y<0)){
        cout << 0 << endl;
    }
    else if((x+y)==0){
        cout << "infinity" << endl;
    }
    else{
        ll z = x+y;
        ll ans = 1ll;
        if(x<0){
            if(z<0){
                cout << 0 << endl;
                return 0;
            }
            x = -x;
            ll c = x/z;
            ans += 2*c;
            if(x%z==0){
                ans--;
            }
        }
        else{
            if(z>0){
                cout << 0 << endl;
                return 0;
            }
            z = -z;
            ll c = x/z;
            ans += 2*c;
            if(x%z==0){
                ans--;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String[]W = new String[n];
    ArrayList<String>ans  = new ArrayList<>();
    
    for(int i=0; i<n; i++) {
    	W[i] = sc.next();
    	if(!ans.contains(W[i])){		
    	      ans.add(W[i]);
    }
    } 	
    int cou = 0;
    for(int i=0; i<n-1; i++) {
    	if(W[i].charAt(W[i].length()-1) != (W[i+1].charAt(0))){
    		cou++;
    }
    }
    if(ans.size()!=n){	
        	System.out.println("No");
    }else if(cou != 0){
    	  System.out.println("No");
    }else {
    	 System.out.println("Yes");
     }
}
}


Measured memory_bytes: 35820
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n; cin>>n;
    int ans=0;
    for(int i=1; i<=n; i+=2){
        int cnt=0;
        for(int j=1; j<=n; j++){
            if(i%j==0) cnt++;
        }
        if(cnt==8) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc,char* argv[]) {
	char searchfor[11];
	int ringnum;
	int i;
	int count;
	char ring[11];
	char ringbuf[21];
	scanf("%s",searchfor);
	scanf("%d",&ringnum);
	count=0;
	for(i=0;i<ringnum;i++) {
		scanf("%s",ring);
		strcpy(ringbuf,ring);
		strcat(ringbuf,ring);
		if(strstr(ringbuf,searchfor))count++;
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 624
pp  = list(map(int, input().split()))
n = int(input())

def project(bb, p=pp):
    ans = []
    a = (p[0]-p[2], p[1]-p[3])
    b = (bb[0]-p[0], bb[1]-p[1])
    c = dot(a,b)/length(a)**2
    ans += [c*i for i in a] 
    print(ans[0]+p[0], ans[1]+p[1])
    

def length(vector):
    ans = 0
    for i in vector:
        ans += i**2
    return ans**(1/2)
    
    
def dot(a, b):
    n = len(a)
    if n != len(b):
        return None
    ans = 0
    for i, j in zip(a, b):
        ans += i*j
    return ans
    
for i in range(n):
    b = list(map(int, input().split()))
    project(b)


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    vector<ll> a{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;
    cout << a[K-1] << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
while 1:
    m, nmin, nmax = map(int,input().split())
    if m==0: break
    p = []
    ans = 0
    smax = 0
    for i in range(m):
        p.append(int(input()))
        if nmin <= i < nmax+1 and p[i-1] - p[i] >= smax:
            # print(p[i - 1], p[i], smax)
            smax = p[i-1] - p[i]
            ans = i
    print(ans)


Measured memory_bytes: 5616
N = int(input())
A = list(map(int,input().split()))

def Linear_Approximation(i,list):
    sum = 0
    for j in range(N):
        sum += abs(list[j]-i)
    return sum

for i in range(N):
    A[i] = A[i] - (i+1)
A.sort()
if N % 2 == 0:
    print(Linear_Approximation(A[(N-1)//2],A))
else:
    print(Linear_Approximation(A[(N-1)//2],A))

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;

template<typename T>
static inline void chmin(T & ref, const T  value) {
	if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
	if (ref < value) ref = value;
}

ll a, b, c, k;

bool dfs(ll aa, ll bb, ll cc, ll s) {
	if (s == k) {
		if (aa < bb && bb < cc) return true;
		return false;
	}
	if (aa < bb && bb < cc) return true;
	if (dfs(aa * 2, bb, cc, s + 1)) return true;
	if (dfs(aa, bb * 2, cc, s + 1)) return true;
	if (dfs(aa, bb, cc * 2, s + 1)) return true;
	return false;
}

int main() {
	cin >> a >> b >> c >> k;

	if (dfs(a, b, c, 0)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	if(n == 1){
		cout << (a==b?"1":"0") <<endl;
		return 0;
	}
	if(a>b)cout << "0" << endl; else{
		long long int S = (n-2LL)*a, E = (n-2LL)*b;
		cout << E - S + 1 <<endl;
	}
	return 0;
}


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

int main() {
	long long a, b;
	cin >> a >> b;
	if (a < 0 && b < 0) {
		if ((b - a) % 2 == 0)cout << "Negative" << endl;
		else cout << "Positive" << endl;
	}
	else if (a > 0 && b>0) {
		cout << "Positive" << endl;
	}
	else cout << "Zero" << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut edges = vec![];
    for i in 0..m {
        let v = read_vec::<usize>();
        let (a, b) = (v[0] - 1, v[1] - 1);
        edges.push((a, b));
    }

    let mut ans = 0;
    for i in 0..m {
        let mut uft = UnionFindTree::new(n);
        for j in 0..m {
            if i == j {
                continue;
            }
            uft.unite(edges[j].0, edges[j].1);
        }
        if uft.get_size(0) < n {
            ans += 1;
        }
        debug!(uft.get_size(0));
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[derive(Debug, Clone)]
struct UnionFindTree {
    parent: Vec<isize>,
    size: Vec<usize>,
    height: Vec<u64>,
}

impl UnionFindTree {
    fn new(n: usize) -> UnionFindTree {
        UnionFindTree {
            parent: vec![-1; n],
            size: vec![1usize; n],
            height: vec![0u64; n],
        }
    }

    fn find(&mut self, index: usize) -> usize {
        if self.parent[index] == -1 {
            return index;
        }
        let idx = self.parent[index] as usize;
        let ret = self.find(idx);
        self.parent[index] = ret as isize;
        ret
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }

    fn get_size(&mut self, x: usize) -> usize {
        let idx = self.find(x);
        self.size[idx]
    }

    fn unite(&mut self, index0: usize, index1: usize) -> bool {
        let a = self.find(index0);
        let b = self.find(index1);
        if a == b {
            false
        } else {
            if self.height[a] > self.height[b] {
                self.parent[b] = a as isize;
                self.size[a] += self.size[b];
            } else if self.height[a] < self.height[b] {
                self.parent[a] = b as isize;
                self.size[b] += self.size[a];
            } else {
                self.parent[b] = a as isize;
                self.size[a] += self.size[b];
                self.height[a] += 1;
            }
            true
        }
    }
}


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

int main(){
    int  n, ans = 1000;
    cin >> n;
    rep(i, 10){
        if(n <= ans){
            ans -= n;
            break;
        }
        ans += 1000;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int lcm(int a, int b) { return a * b / gcd(a, b); }

int num(int a, int b, int c) { return a / c + a / b - a / lcm(b, c); }

signed main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << b - a + 1 - (num(b, c, d) - num(a - 1, c, d)) << endl;
  // cerr << num(b, c, d) << " " << num(a - 1, c, d) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <list>
#include <cmath>
#include <stack>
#include <queue>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int remain = 0;
	char before = ' ';
	for (int i = 0; i < n; i++)
	{
		if (s[i] != before)
		{
			remain++;
			before = s[i];
		}
	}
	cout << remain;
}


Measured memory_bytes: 31744
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 1;
//-----------------------------------------------//

int main() {
	string s;
	cin >> s;
	
	cout << count(ALL(s), '1') << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
typedef unsigned int  ui;
using namespace std;
const ui MAXP = 103000;
vector<int> p;

void initPrime(){
  p.push_back(2);
  bool isPrime;
  for(int i = 3;;i+=2){
    isPrime = true;
    for(ui j = 0;j < p.size();j++){
      if(i%p[j] == 0){
	isPrime = false;
	break;
      }
    }
    if(isPrime == true){
      p.push_back(i);
      if(i >= MAXP)break;
    }
  }
}



int M(int N,int P){
  //beginはN以上の最初に現れる素数
  vector<int>::const_iterator begin = upper_bound(p.begin(),p.end(),N);

  vector<int> sum;
  for(int i = 0;i <= P;i++){
    for(int j = i;j <= P;j++){
      sum.push_back(*(begin+i) + *(begin+j) );
    }
  }
  sort(sum.begin(),sum.end());
  return sum[P-1];
}

int main(){
  int N,P;
  initPrime();
  while(cin >> N >> P && N+P >= 0){
    cout << M(N,P) << endl;
  }
  return 0;
}

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

int main(void)
{
    int num[26]{0};
    string w;
    cin >> w;
    for(int i{0}; i<w.size(); ++i){
        ++num[w[i]-'a'];
    }

    for(int i{0}; i<26; ++i){
        if(num[i]%2==1){
            cout << "No" << endl;
            return(0);
        }
    }
    cout << "Yes" << endl;
    return(0);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool Judge(int W, int H, int x, int y, int r);

bool Judge(int W, int H, int x, int y, int r)
{
	if(x - r < 0) return false;
	if(x + r > W) return false;
	if(y - r < 0) return false;
	if(y + r > H) return false;
	
	return true;
}

int main()
{
	int W, H, x, y, r;
	
	cin >> W >> H >> x >> y >> r;

	if(Judge(W, H, x, y, r)){
		cout << "Yes" << endl;
	} else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define nl cout<<"\n"
#define fr(n) for(int i = 0; i<n; i++)
#define frr(j, n) for(int i = j; i<n; i++)
using namespace std;
typedef long long int lli;
int main(){
    int h, w, m, hi, wi;
    cin>>h>>w>>m;
    int rows[h+1] ={0}, cols[w+1] = {0};
    vector<vector<int>> a(300005);
    vector<vector<int>> b(300005);
    while(m--){
        cin>>hi>>wi;
        a[hi].push_back(wi);
        b[wi].push_back(hi);
        rows[hi]++;
        cols[wi]++;
    }
    int max_row = 1, max_col = 1;
    frr(1,h+1){
        if(rows[i]>rows[max_row])max_row = i;
    }
    for(auto x:a[max_row]){
        cols[x]--;
    }
    frr(1,w+1){
        if(cols[i]>cols[max_col])max_col = i;
    }
    int ans1 = rows[max_row]+cols[max_col];
    for(auto x:a[max_row]){
        cols[x]++;
    }
    max_col = max_row = 1;
    frr(1,w+1){
        if(cols[i]>cols[max_col])max_col = i;
    }
    for(auto x:b[max_col]){
        rows[x]--;
    }
    frr(1,h+1){
        if(rows[i]>rows[max_row])max_row = i;
    }
    int ans2 = rows[max_row]+cols[max_col];
    cout<<max(ans1, ans2);
}

Measured memory_bytes: 38372
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>

#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{

    
    int h1, m1, h2, m2, k;
    int res = 0;
    
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    
    res = (h2 - h1)*60 + m2 - m1 - k;
    
    cout << res;
    

}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cctype>

using namespace std;

string shuffle(string str, int h) {
	string head = str.substr(0, h);
	string tail = str.substr(h, str.size() - h);
	return tail + head;
}

int main() {
	string cards;
	int m, h;

	while (1) {
		cin >> cards;
		if (cards == "-")break;

		cin >> m;
		for (int i = 0; i < m; i++) {
			cin >> h;
			cards = shuffle(cards, h);
		}
		cout << cards << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
using ld = long double;
int C[52][52];
int ncr(int n,int r)
{
	return C[n][r];
}
int32_t main()
{
	
	for(int i=0;i<=50;i++)C[i][0]=1;
	for(int i=1;i<=50;i++)
	for(int j=1;j<=50;j++)
	{
		C[i][j]=C[i-1][j-1]+C[i-1][j];
	}
	
	
	
	int n;
	cin>>n;
	int a[n];
	int A,B;cin>>A>>B;
	map<int,int> f;
	for(auto &i:a)
	{cin>>i;f[i]++;}
	
	sort(a,a+n);
	reverse(a,a+n);
	int pre[n+1];
	pre[0]=0;
	for(int i=1;i<=n;i++)pre[i]=a[i-1]+pre[i-1];
	vector<ld> val;
	vector<pair<int,int>> sid;
	for(int i=A;i<=B;i++)
	{
		ld sum=((ld)pre[i])/(ld)i;
		val.push_back(sum);
		sid.push_back({pre[i],i});
	}
	
	ld mx=*max_element(val.begin(),val.end());
	cout<<fixed<<setprecision(6)<<mx<<"\n";
	int ways=0;
	for(auto i:sid)
	{
		int reqd=i.second;
		int sum=i.first;
		ld test=(ld)sum/(ld)reqd;
		if(test!=mx)continue;
		map<int,int> re;
		for(int i=0;i<reqd;i++)
		{
			re[a[i]]++;
		}
		int pro=1;
		for(auto j:re)
		{
			pro*=ncr(f[j.first], j.second);
		}
		ways+=pro;
		
	}
	cout<<ways;
	
	
}

Measured memory_bytes: 256
n = gets.chomp.to_i
array = []

n.times do
  array << gets.chomp.to_i
end

array_max = array.sort.reverse
i = 0

n.times do |i|
    if array[i] != array_max[0]
        puts array_max[0]
    else
        puts array_max[1]
    end
end


Measured memory_bytes: 7784
#include<iostream>
using namespace std;
int a[200010];
int main() {
	int n,k;
	cin>>n>>k;
	for(int i=1; i<=n; i++) cin>>a[i];
	for(int i=1; i<=n-k; i++) {
		if(a[i]<a[i+k]) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

Measured memory_bytes: 4376
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

MOD = 10**9 + 7

N,M = map(int,readline().split())
S = list(map(int,readline().split()))
T = np.array(['0']+readline().split(),np.int32)

# Sは左から見ていく。
# Tについて、（最後に一致させた文字の位置、通り数）をdpで持つ

dp = np.zeros(M+1,dtype=np.int64)
dp[0] = 1

for i,s in enumerate(S,1):
    prev = dp
    prev_cum = prev.cumsum() % MOD
    equal = (s == T)
    dp[1:] += equal[1:] * prev_cum[:-1]
    dp[dp>=MOD] -= MOD

answer = dp.sum() % MOD
print(answer)

Measured memory_bytes: 14432
#include <iostream>

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

int main() {
  int n;
  std::cin >> n;
  int p[n + 1];
  for (int i = 1; i <= n; ++i) { std::cin >> p[i - 1] >> p[i]; }

  int c[n + 1][n + 1];
  for (int i = 1; i <= n; ++i) c[i][i] = 0;

  for (int l = 2; l <= n; ++l) {
    for (int i = 1; i <= n - l + 1; ++i) {
      int j = i + l - 1;
      c[i][j] = 1 << 21;
      for (int k = i; k < j; ++k) {
        c[i][j] =
            std::min(c[i][j], c[i][k] + c[k + 1][j] + p[i - 1] * p[k] * p[j]);
      }
    }
  }

  std::cout << c[1][n] << '\n';
  return 0;
}



Measured memory_bytes: 3080
def main() -> None:
    n = int(input())
    menu = [[int(x) for x in input().split()] for _ in range(n)]

    for i, _ in enumerate(menu):
        menu[i] += [sum(menu[i])]

    menu.sort(key=lambda x: x[len(x) - 1], reverse=True)

    cnt = 0
    for i in range(n):
        if i % 2 == 0:
            cnt += menu[i][0]
        else:
            cnt -= menu[i][1]

    print(cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 65624
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define double long double
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y);}y =(y*y);b/=2;}return x
;}



signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<": ";
   int n;
   cin>>n;string s="";
  while(n>0)
  {
   char ch='a'+(n-1)%26;
   s=ch+s;
   if(n%26==0)n--;
   n/=26;
  }
   cout<<s<<endl;
}


return 0;
}





Measured memory_bytes: 3588
#96 C - Typical Stairs
N,M = map(int,input().split())
A = [int(input()) for _ in range(M)]
A = set(A)
MOD = 1000000007

dp = [0]*(N+1)
dp[0] = 1
for i in range(1,N+1):
    if i in A:
        continue
    dp[i] = (dp[i-1] + dp[i-2])%MOD
print(dp[N])

Measured memory_bytes: 18980
#include <iostream>

using namespace std;

int main()
{
  int n, m, s, t, u;

  while(cin >> n && n){
    cin >> m;
    u = 0;
    while(m--){
      cin >> s >> t;
      u += (t-s);
    }
    if(u >= n) cout << "OK" << endl;
    else cout << (n-u) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N + 1, 0);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }

    map<int, int> cnt1, cnt2;
    for (int i = 1; i <= N; i++) {
        cnt1[-A[i] - i]++;
        cnt2[-A[i] + i]++;
    }

    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        ans += cnt1[A[i] - i];
        ans += cnt2[A[i] + i];
    }
    cout << ans / 2 << endl;
}


Measured memory_bytes: 37896
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int,Int>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int LCM(Int a, Int b){
    return a*b/GCD(a,b);
}


int main() {
    string s;

    cin >> s;


    string ans = "";

    if(s == "Sunny"){
        ans = "Cloudy";

    }else if (s == "Cloudy"){
        ans = "Rainy";
    }else if (s == "Rainy"){
        ans = "Sunny";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np
import math
import scipy
import itertools

def score(arr):
    hoge = 0
    for ai, bi, ci, di in zip(a, b, c, d):
        if arr[bi-1] - arr[ai-1] == ci:
            hoge += di
    return hoge

def dfs(arr):
    if len(arr) == n:
        return score(arr)
    res = 0
    prev_last = arr[-1] if len(arr) > 0 else 0
    for v in range(prev_last, m):
        arr.append(v)
        res = max(res, dfs(arr))
        arr.pop()
    return res

def solve():
    global a, b, c, d, n, m, q
    n, m, q = map(int, input().split())
    a, b, c, d = [0]*q, [0]*q, [0]*q, [0]*q
    for i in range(q):
        a[i], b[i], c[i], d[i] = map(int, input().split())
    print(dfs([]))
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 31128
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(input())
d=list(map(int,input().split()))
mod=998244353
if d[0]!=0:
    print(0)
    quit()
d.sort()

if d[1]==0:
    print(0)
    quit()
ans=1
last=1
now=1
cnt=0
i=1
while(i<n):
    if now==d[i]:
        cnt+=1
    elif now+1==d[i]:
        if cnt==0:
            print(0)
            quit()
        ans*=pow(last,cnt)
        ans=ans%mod
        last=cnt
        now=d[i]
        cnt=1
    else:
        print(0)
        quit()
    i+=1
if cnt>0:
    ans*=pow(last,cnt)
print(ans%mod)

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
struct Edge {
    int to;
    int weight;
    Edge(int t, int w)
        : to(t)
        , weight(w)
    {
    }
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

// 負の数にも対応した % 演算
long long mod(long long val, long long m)
{
    long long res = val % m;
    if (res < 0)
        res += m;
    return res;
}

// a^n modを計算する
long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    // nを2進数表示して1が埋まっている桁に関してはa^mをかけていく
    while (n > 0) {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod)
{
    return modpow(a, mod - 2, mod);
}

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    vector<int> penalty(N);

    map<int, string> dic;

    for (int i = 1; i <= N; i++) {
        dic[i] = "WA";
    }

    int seikai = 0;
    int gotou = 0;
    for (int i = 0; i < M; i++) {
        cin >> p.at(i) >> S.at(i);
        if (dic[p.at(i)] == "WA" && S.at(i) == "AC") {
            dic[p.at(i)] = "AC";
            seikai++;
        }
        if (dic[p.at(i)] == "WA" && S.at(i) == "WA") {
            penalty.at(p.at(i) - 1)++;
        }
    }

    for (int i = 1; i <= N; i++) {
        if (dic[i] == "AC")
            gotou += penalty.at(i - 1);
    }

    cout << seikai << " " << gotou << endl;
}

Measured memory_bytes: 17408
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() { 
  int h,w,a,b;
  cin >> h >> w >> a >> b;
  vector<vp> mat(h);
  vector<vi> ans(h,vi(w,0));
  int wa = w-a;
  int hb = h-b;
  rep(i,b) {
    rep(j,a) printf("1");
    rep(j,w-a-1) printf("0");
    printf("0\n");
  }
  rep(i,h-b) {
    rep(j,a) printf("0");
    rep(j,w-a-1) printf("1");
    printf("1\n");
  }
  return 0;
}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

struct UnionFind{
    vector<ll> P;
    UnionFind(ll n):P(n,-1){}

    ll root(ll n){
        if( P[n] < 0 ) return n;
        else return P[n] = root(P[n]);
    }

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

    bool unite(ll x, ll y){
        x = root(x);
        y = root(y);
        if( x == y ) return false;
        if( -P[x] > -P[y] ) swap(x,y);
        P[y] += P[x];
        P[x] = y;
        return true;
    }

    ll size(ll n){ return -P[root(n)]; };
};

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;
    ll M;
    ll K;

    cin >> N >> M >> K;

    UnionFind friends(N+1);

    vector<ll> directFriends(N+1, 0);

    REP(i, M){
        ll A, B;
        cin >> A >> B;
        friends.unite(A,B);
        directFriends[A]++;
        directFriends[B]++;
    }

    vector<ll> ans(N+1);
    REP(i, N+1){
        ans[i] = friends.size(i) - 1 - directFriends[i];
    }

    REP(i, K){
        ll C, D;
        cin >> C >> D;
        if( friends.same(C, D) ){
            ans[C]--;
            ans[D]--;
        }
    }

    REP(i, N){
        cout << ans[i+1] << " ";
    }
    cout << endl;

    return 0;

}


Measured memory_bytes: 3200
# include<iostream>
# include<algorithm>
# include<cmath>
using namespace std;
int main ()
{
      long long X;
      cin>>X;
      long long sum =100;
      int t=0;
      while(sum<X)
      {
      	  sum = sum+sum/(long long)100;
      	 // cout<<t<<endl;
      	  
      	  t++;
	  }
	  cout<<t<<endl;
}

Measured memory_bytes: 3676