akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#define ll long long

using namespace std;
typedef pair<int, int> P;

int main()
{
    int n, k;
    cin >> n >> k;
    int p[1010];
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    sort(p, p + n);
    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3576
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int N;
int main()
{
	scanf("%d",&N);
	if (N%2==0) printf("%d",N);
	    else printf("%lld",N*2);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i = 0; i < n; i++)
#define rep2(i,start,end) for(ll i = start; i < end; i++)
#define dwn(i,n) for(int i = n; i >= 0; i--)
#define dwn2(i,start,end) for(ll i = start; i >= end; i--)
#define pll pair<ll,ll>
#define mk(x,y) make_pair(x,y)
#define pdl pair<double, ll>
const ll N = 4e5 + 200;
const ll INF = 0x3f3f3f;
const ll mod = 1e9 + 7;


int main(){
	int n;
	cin>>n;
	for(int i = 1; i <= 9; i++){
		for(int j = 1; j<= 9; j++){
			if(i * j == n){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;


	return 0;
}




//abac

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

struct P {
  string first;
  int second;
  int third;
};

constexpr int MAX_N = 100+9;

P p[MAX_N];

int main() {
  int N; cin >> N;
  for (int i{}; i < N; ++i) {
    string S;
    int P;
    cin >> S >> P;
    p[i].first = S;
    p[i].second = P;
    p[i].third = i + 1;
  }
  sort(p, p+N, [](P l, P r) {
    if (l.first == r.first)
      return l.second > r.second;
    return l.first < r.first;
  });

  for (int i{}; i < N; ++i)
    cout << p[i].third << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;
const int MAX = 100100;

struct Edge {
    int to, cost;
};

int main() {
    int k;
    cin >> k;
    vector<Edge> graph[MAX];
    for (int i = 1; i <= k; i++) {
        graph[i].push_back((Edge){(i+1)%k, 1});
        graph[i].push_back((Edge){(i*10)%k, 0});
    }

    vec dist(k, INF);
    dist[1] = 1;

    deque<int> que;
    que.push_front(1);

    while (!que.empty()) {
        int v = que.front();
        que.pop_front();

        for (auto&& e : graph[v]) {
            int to = e.to;
            if (dist[to] > dist[v] + e.cost) {
                dist[to] = dist[v] + e.cost;
                if (e.cost > 0) que.push_back(to);
                else que.push_front(to);
            }
        }
    }
    cout << dist[0] << endl;
    return 0;
}

Measured memory_bytes: 9396
from collections import deque


H, W = map(int, input().split())
maze = [list(input()) for _ in range(H)]

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

checked = [[False for _ in range(W)] for _ in range(H)]

que = deque()
flag = False
for i in range(H):
    for j in range(W):
        if maze[i][j] == '#':
            que.append((i, j))
            checked[i][j] = True
        else:
            flag = True

if flag is False:
    print('0')
    exit()

n_que = deque()
step = 0
while len(que):

    h, w = que[0][0], que[0][1]
    que.popleft()
    for d in range(4):
        nh, nw = h + dy[d], w + dx[d]
        if nh < 0 or nw < 0 or nh >= H or nw >= W:
            continue
        if checked[nh][nw] is True:
            continue
        n_que.append((nh, nw))
        checked[nh][nw] = True

    if len(que) == 0:
        if len(n_que) == 0:
            print(step)
            exit()
        que = n_que
        n_que = deque()
        step += 1


Measured memory_bytes: 122716
#include <stdio.h>
int main(void){
    int n,b,f,r,v,i,j,k;//b棟f階のr番目の部屋にv人
    int ary[4][3][10] = {0};
    scanf( "%d" , &n );

    while( n ){
        scanf("%d %d %d %d\n" , &b, &f, &r, &v );
        ary[b-1][f-1][r-1] += v;
        n--;
    }

    for( i = 0; i < 4 ; i++ ){
        for( j = 0 ; j < 3 ; j++ ){
          for( k = 0 ; k < 10 ; k++ ){
              printf(" %d" , ary[i][j][k] );
          }
          printf("\n");
        }
        if( i != 3 ) printf("####################\n");
    }
}


Measured memory_bytes: 2108
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
sum_A = sum(A)
A = Counter(A)
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    A.setdefault(b, 0)
    sum_A += (c - b) * A[b]
    A.setdefault(c, 0)
    A[c] += A.pop(b)
    print(sum_A)

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

//define ll long long;
//define ar array;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int x = n%10;
    if (x == 3){
        cout << "bon" << endl;
    }
    else if (x == 0 || x == 1 || x == 6 || x == 8){
        cout << "pon" << endl;
    }
    else {
        cout << "hon" << endl;
    }

    return 0;
}



Measured memory_bytes: 3556
def luca i
  return $arr[i - 1] \
    + $arr[i - 2]
end

n = gets.to_i
$arr = Array.new(n + 1)
$arr[0] = 2
$arr[1] = 1

(2..n).each { |i|
  $arr[i] = luca i
}
p $arr[-1]

Measured memory_bytes: 3836
#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()

void solve() {
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    m[t]++;
  }
  int s = 0;
  for (auto &i : m) {
    s += i.sc - 1;
  }
  int ans = s / 4 * 4;
  s %= 4;
  if (s >= 3) {
    s -= 2;
    ans += 2;
  }
  if (s != 0) {
    ans += 2;
  }
  cout << n - ans << '\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--) solve();
}


Measured memory_bytes: 9764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long int li;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
typedef tuple<double,ll,ll>T;
#define PI 3.14159265358979
const int MOD = 1e9 + 7;

int main(){
  ll A,B,Q;
  cin>>A>>B>>Q;
  vector<ll>a(A+2);
  vector<ll>b(B+2);
  vector<ll>q(Q);
  a[0]=-100000000000ll;
  b[0]=-100000000000ll;
  a[A+1]=100000000000ll;
  b[B+1]=100000000000ll;
  rep(i,A){cin>>a[i+1];}
  rep(i,B){cin>>b[i+1];}
  rep(i,Q){cin>>q[i];}
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  rep(i,Q){
  	auto t=*upper_bound(a.begin(), a.end(), q[i]);
    auto k=upper_bound(a.begin(), a.end(), q[i]);
    k--;
    ll T=*k;
    auto s=*upper_bound(b.begin(),b.end(), q[i]);
    auto u=upper_bound(b.begin(),b.end(), q[i]);
    u--;
    ll S=*u;
    ll x=abs(t-q[i]),w=abs(T-q[i]),z=abs(s-q[i]),y=abs(S-q[i]);
    ll ans=min(min(max(w,y),max(x,z)),min(w+z+min(w,z),x+y+min(x,y)));  
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3712
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl	   '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        998244353
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii	    map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
ll dp[3005][3005];
ll add(ll x,ll y,ll mod=hell) { x += y; if(x >= mod) x -= mod; return x;}
ll sub(ll x,ll y,ll mod=hell) { x -= y; if(x < 0) x += mod; return x;}
ll mul(ll x,ll y,ll mod=hell) { return (x * 1ll * y) % mod;}
void solve()
{
	ll n,s;
	cin>>n>>s;
	dp[0][0]=1;
	rep(i,1,n+1){
		ll x;
		cin>>x;
		rep(j,0,s+1){
			dp[i][j]=mul(dp[i-1][j],2);
		}
		rep(j,0,s+1){
			if(j+x<=s){
				dp[i][j+x]=add(dp[i][j+x],dp[i-1][j]);
			}
		}
	}
	cout<<dp[n][s]<<endl;
}
signed main()
{
	
		/***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
		
	}
	TIME
	return 0;
}

Measured memory_bytes: 74244
n, k = map(int, input().split())
v = [int(e) for e in input().split()]
m = min(n, k)
result = 0
for i in range(m + 1):
  for j in range(i + 1):
    t = v[:j]
    t.extend(v[n - (i - j):])
    t.sort()
    l = k - i
    while len(t) > 0 and l > 0 and t[0] < 0:
      t = t[1:]
      l -= 1
    m = sum(t)
    if m > result:
      result = m
print(result)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
while(true){
int h,w;
cin>>h>>w;
if(h==0&&w==0)
return 0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(i==0||i==h-1||j==0||j==w-1)
cout<<'#';
else
cout<<'.';

}
cout<<'\n';
}
cout<<'\n';

}





}

Measured memory_bytes: 2960
#include<stdio.h>
	int main(void)
{
	int a[3],i,j,temp;
	for(i = 0; i < 3; i++)
		scanf("%d", &a[i]);
	for(i=0; i<3; i++){
		for(j=i+1; j<3; j++){
			if(a[i]>a[j]){
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	for(i = 0; i < 2; i++){
		printf("%d ", a[i]);
	}
	printf("%d", a[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define For(i,l,r) for (register int i=l; i<=r; i++)
using namespace std;
typedef unsigned long long LL;
typedef signed long long ll;
template <typename T>
inline void read(T &x) {
	char c = getchar(); int w = 1; x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int n, a[100055];
int main() {
	read(n);
	For(i,1,n) read(a[i]);
	a[n+1] = 2000000000;
	int last = 0, ans = 0;
	For(i,1,n) {
		ans = max(ans, i-last-1);
		if (a[i] < a[i+1]) last = i;
	}
	cout << ans;
	getchar();
	return 0;
}

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

int main() {
  vector<int> x(5, 0);
  
  int index;
  for(int i = 0; i < 5; i++) {
    cin >> x[i];
    if(x[i] == 0) {
      index = ++i;
    }
  }
  cout << index << endl;
  
  return 0;
}


Measured memory_bytes: 3600
A,B,C,D = map(int,input().split())
aok_attack = -(-A//D) #高橋を倒すための攻撃回数
tkhs_attack = -(-C//B)#青木を倒すための攻撃回数
#print(tkhs_attack)
#print(aok_attack)
if tkhs_attack > aok_attack:
    print('No')
else:
    print('Yes')

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int arr[26];
	string s;
	cin>>s;
	memset(arr,0,sizeof(arr));
	for(long long int i=0;i<s.size();i++){
		int index=s[i]-'A';
		arr[index]++;
	}
	long long int c=0;
	for(long long int i=0;i<26;i++){
		if(arr[i]==2){
			c++;
		}
	}
	if(c==2){
		cout<<"Yes\n";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
unsigned long long int max(unsigned long long int z,unsigned long long int k)
{
  if(z>k)
  {
    return z;
  }
  else
  {
    return k;
  }
}
unsigned long long int min(unsigned long long int z,unsigned long long int k)
{
  if(z<k)
  {
    return z;
  }
  else
  {
    return k;
  }
}


int main()
{
  unsigned long long int n,k;
  cin>>n>>k;
  if(n%k==0)
  {
    cout<<"0"<<endl;
  }
  else
  {
    unsigned long long int z;
    z=n%k;
    unsigned long long int v=max(z,k)-min(z,k);
    if(v<z)
    {
      cout<<v<<endl;
    }
    else
    {
      cout<<z<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
q  = int(input())
m = list(map(int,input().split()))
# bit 全探索
# aから適当にとってm[i]にできるかをそれぞれ答える
# 1.aでできるパターンんお和をbit 全探索で探す
pat_sum = [0]*(2**n)
for i in range(2**n):
  wa = 0
  for j in range(n):
    if i >> j & 1:
      wa += a[j]
  pat_sum[i] = wa
pat_sum.sort()# sortするのを忘れてた
# 2. mをsortして、かつ答えるときのためにidxを保持しておく
m,idx = zip(*sorted(zip(m,range(q))))
# 3. while で回して、i,jを末端にいくまで添字をしたからずらして、matchするかを確かめる
a_idx = 0
m_idx = 0
# point ２つの配列を添字をずらしながら全探索するときはwhile a < len or b<lenとする
ans = [""]*q#sortした時の順番で入る
# 回す時の順番はpat_sumを回す
while a_idx < 2**n:#抜ける時が==n m_idx == qは抜けてからno 埋め
  if pat_sum[a_idx] > m[m_idx]: # 小さい方を添字上げる
    ans[idx[m_idx]] = "no"
    m_idx += 1
  elif pat_sum[a_idx] < m[m_idx]:
    a_idx += 1
  else:# = の時は、探索する方の添字を上げる in case same element in m
    ans[idx[m_idx]] = "yes"
    m_idx += 1
  if m_idx == q:
    break
# 同じelementが複数ある時にerror
# a_idx ==n とm_idx == qで条件分岐する
# while の時、添字+=1するのわすれガチ
while m_idx < q:
  ans[idx[m_idx]] = "no"
  m_idx += 1
# 4. idx　の順に出力
for i in range(q):
  print(ans[i])



Measured memory_bytes: 46988
#include <stdio.h>

int main(void)
{
	int m, f, b, a, c;
	
	scanf("%d" "%d" "%d", &m, &f, &b);
	
	a = b - m;
	if(a > 0){
		c = f - a;
		if(c < 0){
			printf("NA\n");
		}
		else{
			printf("%d\n",a);
		}
	}
	else{
		printf("0\n");
	}
	
	return 0;
}



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

namespace ABC115
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            if (a == 25)

                Console.WriteLine("Christmas");
            else if (a == 24)
                Console.WriteLine("Christmas Eve");
            else if (a == 23)
                Console.WriteLine("Christmas Eve Eve");
            else if (a == 22)
            {
                Console.WriteLine("Christmas Eve Eve Eve");
            }
            Console.ReadKey();
             }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <list>

#define rep(i, first, to) for(ll i = first; i < to; ++i)
#define REP(i, first, to) for(ll i = first; i <= to; ++i)

using namespace std;
typedef long long ll;

list<int> from[101];
int to[101][101];
int n;
void solve() {
	cin >> n;
	rep(i, 0, n) {
		int u, k;
		cin >> u >> k;
		rep(j, 0, k) {
			int value;
			cin >> value;
			from[u].push_back(value);
		}
	}
	REP(i, 1, n) {
		while(!from[i].empty()) {
			to[i][from[i].front()] = 1;
			from[i].pop_front();
		}
	}
	REP(i, 1, n) {
		REP(j, 1, n) {
			if (j == n) {
				cout << to[i][j] << endl;
			} else {
				cout << to[i][j] << " ";
			}
		}
	}
}

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

Measured memory_bytes: 3144
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph emplace
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n,p[20006];
ll magic=20001;
int main()
{
	FAST
	cin>>n;
	FOR(i,0,n){
		ll a; cin>>a;
		p[a-1]=i;
	}
	FOR(i,0,n){
		cout<<(i+1)*magic<<' ';
	}
	cout<<'\n';
	FOR(i,0,n){
		cout<<(n-i)*magic+(p[i]+1)<<' ';
	}
	cout<<'\n';
}


Measured memory_bytes: 768
#include <cstdio>

char f(char c){
    return (char)((int)c - 32);
}

int main(){
    char s1[11], s2[11], s3[11];
    scanf("%s %s %s", s1, s2, s3);
    printf("%c%c%c\n", f(s1[0]), f(s2[0]), f(s3[0]));
    return 0;
}

Measured memory_bytes: 128
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll N;
    cin >> N;
    if(N <= 2) {
        cout << "No" << endl;
        return 0;
    }
    VV<ll> edges(2 * N + 1);
    for(ll i = 3; i <= N - !(N & 1); i += 2) {
        edges[i].push_back(i - 1);
        edges[i - 1].push_back(1);
        edges[i - 1 + N].push_back(i + N);
        edges[i + N].push_back(1);
    }
    edges[1 + N].push_back(3);
    if(N % 2 == 0) {
        ll tmp = 0;
        for(ll i = 0;; i++) {
            tmp += 1ll << i;
            if((N >> i) & 1) break;
        }
        if(N <= tmp) {
            cout << "No" << endl;
            return 0;
        }
        tmp--;
        edges[N].push_back(tmp);
        edges[2 * N].push_back(2 * N - 1);
    }

    cout << "Yes" << endl;
    for(ll i = 1; i <= 2 * N; i++) for(ll ele : edges[i]) cout << i << ' ' << ele << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

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

void read() {};

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

void print() {};

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

int main() {
  double A, B; cin >> A >> B;
  for(int i = 1; i <= 100000; i++) {
    double x = (i * 1.0) * (8.0 / 100.0);
    double y = (i * 1.0) * (1.0 / 10.0);
    int p = x, q = y;
    if(A == p and B == q) {
      print(i);
      return 0;
    }
  }
  print("-1");
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str;
        int i,j;
        int a,b;
        while(true) {
            str = scan.nextLine();
            String[] num = str.split(" ", 0);
            a = Integer.valueOf(num[0]);
            b = Integer.valueOf(num[1]);
            if(a==0&&b==0){
                break;
            }

            for (i = 0; i < a; i++) {
                for (j = 0; j < b; j++) {
                    if((i+j)%2==0){
                    System.out.print("#");

                    }else{
                        System.out.print(".");
                    }

                }
                System.out.println();
            }
            System.out.println();
        }
        scan.close();
    }
}


Measured memory_bytes: 32856
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    ll h, n;
    cin >> h >> n;
    ll sum  = 0;
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        sum += temp;
    }
    if (sum >= h) puts("Yes");
    else puts("No");
    return 0;
}




Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    n,m=map(int,input().split())
    print((n-1)*(m-1))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n,k; cin >> n >> k;
    if (n % k == 0)
    {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons;
import core.bitop, core.thread;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return readToken().to!int; }
long readLong() { return readToken().to!long; }
real readReal() { return readToken().to!real; }

void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); }


int N, W;
int[] X;
long[] V;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      W = readInt();
      X = new int[N];
      V = new long[N];
      foreach (i; 0 .. N) {
        X[i] = readInt();
        V[i] = readLong();
      }
      auto dp = new long[W + 1];
      foreach (i; 0 .. N) {
        foreach_reverse (w; X[i] .. W + 1) {
          chmax(dp[w], dp[w - X[i]] + V[i]);
        }
      }
      writeln(dp[W]);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 2556
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
    int n,k;
    double l;
    cin >> n >> k;
    l = log(n) / log(k);
    cout << floor(l) + 1 << endl;

    return 0;


}

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

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cout << endl; }

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

#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define task "sol"

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    vector<int> dd(10);
    int ans = 0;
    for (int i = 1; i <= 3; i++){
        int x;
        cin >> x;
        dd[x] ++ ;
        ans = max(ans,dd[x]);
    }
    if (ans == 2) cout << "Yes";
    else cout << "No";
}








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

#define MOD_1000000007 (1000000007LL)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)

using std::cerr;
using std::cout;
using std::endl;
using std::make_pair;
using std::map;
using std::pair;
using std::priority_queue;
using std::set;
using std::string;
using std::vector;
typedef long long ll;

vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
  int k;
  scanf("%d", &k);
  printf("%d\n", a[k-1]);
  return 0;
}

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

using namespace std;

int main()
{
  int nums[5],pos;

  for(int i = 0; i < 5; i++)
  {
    cin >> nums[i];
    if(nums[i] == 0)
        pos = i+1;
  }

    cout << pos;

}



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

using namespace std;

int n;
int s[100];
vector<int> aans;

int main(){
	while(1){
		int ans = 0;
		cin >> n;
		if(n == 0) break;
		for(int i = 0;i < n;i++){
			cin >> s[i];
		}
		sort(s,s+n);
		for(int i = 1;i < n-1;i++){
			ans += s[i];
		}
		
		ans /= n-2;
		
		aans.push_back(ans);
	}
	for(int i = 0;i < aans.size();i++){
		cout << aans[i] << endl;
	}
}

Measured memory_bytes: 3040
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N = I()
A = []
for i in range(N):
    x,y = MI()
    A.append((x,y,i))

if N == 2:
    print(0.5)
    print(0.5)
    exit()


# グラハムスキャン(2次元の場合使用可能)

def area(X,Y,Z):  # 三角形の符号付き面積の2倍
    return (Y[0]-X[0])*(Z[1]-X[1])-(Y[1]-X[1])*(Z[0]-X[0])

from operator import itemgetter

def ConvexHull(A):  # Aの凸包を形成する点のリストを返す
    A = sorted(A,key=itemgetter(0,1))  # 適宜変更
    res = []
    N = len(A)
    for i in range(N):  # 下側
        a = A[i]
        while len(res) > 1 and area(res[-2],res[-1],a) <= 0:  # 適宜'>,<,>='に変更
            res.pop()
        res.append(a)
    r = len(res)
    for i in range(N-2,-1,-1):  # 上側
        a = A[i]
        while len(res) > r and area(res[-2],res[-1],a) <= 0:  # 適宜'>,<,>='に変更
            res.pop()
        res.append(a)
    return res


B = ConvexHull(A)
del B[-1]
ANS = [0]*N

from math import acos,pi

for j in range(len(B)):
    x,y,i = B[j]
    if j == 0:
        x1,y1,i1 = B[-1]
        x2,y2,i2 = B[j+1]
    elif j == len(B)-1:
        x1,y1,i1 = B[j-1]
        x2,y2,i2 = B[0]
    else:
        x1,y1,i1 = B[j-1]
        x2,y2,i2 = B[j+1]
    ANS[i] = (pi - acos(((x1-x)*(x2-x)+(y1-y)*(y2-y))/((((x1-x)**2+(y1-y)**2)*((x2-x)**2+(y2-y)**2))**.5)))/(2*pi)

print(*ANS,sep='\n')


Measured memory_bytes: 64248
#(39)ICP得点集計ソフトウェア
while True:
     n=int(input())
     if n==0:
          break
     count=0
     for i in range(n-1):
          n=n*(i+1)
     while n%10==0:
          n=n//10
          count+=1
          if n%10>0:
               break
     print(count)


Measured memory_bytes: 5632
#include <stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <limits>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;++a) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define print_double(val,a) cout << fixed << setprecision(a) << val << endl;
ll mod = 1e9 + 7;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	string str = "";
	cin >> str;
	int ans = -12;
	for (int i = 0; i < str.length(); i++) {
		int alpha1[26], alpha2[26];
		rep(i, 26) { alpha1[i] = alpha2[i] = 0; }
		for (int i1 = 0; i1 <= i; i1++) {
			alpha1[str[i1] - 'a']++;
		}
		for (int i1 = i+1; i1 <str.length(); i1++) {
			alpha2[str[i1] - 'a']++;
		}
		int Max = 0;
		for (int i1 = 0; i1 < 26; i1++) {
			if (alpha1[i1] > 0 && alpha2[i1] > 0) {
				Max++;
			}
		}
		ans = max(Max,ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
h,w = map(int, input().split())
s = list()
t = list()
a = [0 for i in range(w+2)]
s.append(a)
for i in range(h):
    b = str(input())
    c = list(('0'+b+'0').replace('.','0').replace('#','1'))
    d = list(map(int, c))
    s.append(d)
    t.append(b)
s.append(a)
flag = 0

for j in range(1,h+1):
    for k in range(1,w+1):
        if flag == 1:
            break
        if s[j][k] == 1:
            cnt = 0
            cnt = s[j-1][k] + s[j][k-1] + s[j][k+1] + s[j+1][k] 
            if cnt == 0:
                flag = 1
                print('No')

if flag == 0:
    print('Yes')

Measured memory_bytes: 9180
def is_all_even(A):
    res = True
    for a in A:
        if a%2 == 1:
            res = False
            return res
    return res


if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

    answer = 0
    while is_all_even(A):
        answer += 1
        A = [a//2 for a in A]

    print(answer)



Measured memory_bytes: 3060
from collections import deque

INF = float("inf")

N, M, *AB = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
    E[a].append(b)
    E[b].append(a)

dist = [INF] * (N + 1)
ans = [-1] * (N + 1)

Q = deque([1])
dist[1] = 0
while Q:
    v = Q.popleft()
    d = dist[v] + 1
    for u in E[v]:
        if dist[u] > d:
            dist[u] = d
            ans[u] = v
            Q.append(u)

print("Yes")
for a in ans[2:]:
    print(a)

Measured memory_bytes: 56540
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100001

void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(int a,int n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){return *(LL*)a-*(LL*)b;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}


int main(){
  LL K,i,a=1,b=0,ans=0;
  char S[101];
  scanf("%s",S);
  scanf("%lld",&K);
  int l=strlen(S);
  FOR(i,0,l-1){
    if(S[i]==S[i+1])a++;
    else ans+=a/2,a=1;
  }
  ans+=a/2,ans*=K,a=1;
  if(S[0]==S[l-1]){
    FOR(i,0,l-1){
      if(S[i]==S[i+1])a++;
      else break;
    }
    if(a!=l){
      b++;
      for(i=l-1;i>0;i--){
        if(S[i]==S[i-1])a++;
        else break;
      }
    }
  }
  if(a%2==1&&b%2==1)ans+=K-1;
  if(a==l)ans=l*K/2;

  printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

int main(){
  int i, j, isFound, count=0;
  string str;
  while(cin >> str){
    isFound = 1;

    if(str.size() != 1){
      for(i=0, j=str.size()-1; i<= str.size()/2; ++i, --j){
        if(str[i] != str[j]){
	  isFound = 0;
	  break;
        }
      }
    }

    if(isFound == 1) count++;
  }
  cout << count <<endl;
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<sstream>
#include<cstdio>
#include<fstream>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;
bool power(int c,int a,int b){
	return pow(c,2)==(pow(a,2)+pow(b,2));
}
int main(){
	int n;
	scanf("%d",&n);
	stringstream buf;
	for(int x=0;x<n;++x){
		int i,j,k;
		scanf("%d %d %d",&i,&j,&k);
		if(power(i,j,k) || power(j,i,k) || power(k,i,j)){
			buf<<"YES\n";
		}else{
			buf<<"NO\n";
		}
	}
	cout<<buf.str();
	return 0;
}

Measured memory_bytes: 1220
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
using namespace std;
 
const long long MAX = -1e18;
const long long MAXN = 3e5 + 5;
long long dp_f[MAXN],dp_e[MAXN],a[MAXN];
 
priority_queue<long long , vector<long long> , greater<long long> > que;
priority_queue<long long>pque;
 
void Slove_f(int n){
	long long sum_f = 0;
	for(int i = 1;i <= 3 * n;i++){
		que.push(a[i]);
		sum_f += a[i];
		dp_f[i] = sum_f;
		if(que.size() > n){
			sum_f -= que.top();
			que.pop();
			dp_f[i] = sum_f;
		}
	}
 
}
 
void Slove_e(int n){
	long long sum_e = 0;
	for(int i = 3 * n;i >= 1;i--){
		pque.push(a[i]);
		sum_e += a[i];
		dp_e[i] = sum_e;
		if(pque.size() > n){
			sum_e -= pque.top();
			pque.pop();
			dp_e[i] = sum_e;
		}
	}
 
}
 
int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= 3 * n;i++) scanf("%lld",&a[i]);
 
	Slove_f(n);	
	Slove_e(n);
 
	long long ans = MAX;
	for(int i = n;i <= 2 * n;i++){
		ans = max(ans,dp_f[i] - dp_e[i + 1]);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 9588
#include<stdio.h>
int main(void){
	int a[1001],b,i,j,n;
	scanf("%d",&n);
	for(i=0;i<n;++i){
		scanf("%d",&a[i]);
	}
	for(--i;i>=0;--i){
		
		if(i==0)printf("%d\n",a[i]);
		else printf("%d ",a[i]);
	}

	return 0;
}

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

double dp[3001][3001];

double solve(vector<double>& ar,int i,int x)
{
    if(x==0)  // no matter how many coins we can get 1 head
        return 1;
    if(i==0)//0 coins
        return 0;

    if(dp[i][x]>-0.9)
       return dp[i][x];

       return dp[i][x] = ar[i]*solve(ar,i-1,x-1)+ (1-ar[i])*solve(ar,i-1,x);

}
int main()
{
    int n;
    cin>>n;
    memset(dp,-1,sizeof dp);
     vector<double>ar(n+1);

     for(int i=1;i<=n;i++)
        cin>>ar[i];

       cout<<fixed<<setprecision(10)<<solve(ar,n,(n+1)/2);
        return 0;
}


Measured memory_bytes: 70912
s=list(input())
ans=0
for i in range(len(s)):
    if len(s)<=1:
        break
    if s[0]==s[-1]:
        del s[0]
        del s[-1]
    else:
        if s[0]=="x":
            ans+=1
            del s[0]
        elif s[-1]=="x":
            ans+=1
            del s[-1]
        else:
            ans=-1
            break
print(ans)


Measured memory_bytes: 9880
n, m = map(int, input().split())
candles = list(map(int, input().split()))
ans = 10 ** 9
for i in range(n - m + 1):
    a = candles[i]
    b = candles[i + m - 1]
    x = max(abs(a), abs(b))
    if a < 0 and b > 0:
        x += min(abs(a) * 2, abs(b) * 2)
    ans = min(ans, x)

print(ans)

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

int r(int pos, bool edges[8][8], bool memo[8], int N) {
	int result = 0;

	bool unfinished = false;
	for (int i=0; i<N; i++) if (!memo[i]) unfinished = true;
	if (!unfinished) return 1;

	for (int i=0; i<N; i++) {
		if (!memo[i] && edges[pos][i]) {
			memo[i] = true;
			result += r(i, edges, memo, N);
			memo[i] = false;
		}
	}

	return result;
}

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

	bool edges[8][8];
	for (int i=0; i<N; i++) for (int j=0; j<N; j++) edges[i][j] = false;
	for (int i=0; i<M; i++) {
		int a, b;
		cin >> a >> b; a--; b--;
		edges[a][b] = edges[b][a] = true;
	}

	bool memo[8];
	for (int i=0; i<N; i++) memo[i] = false;
	memo[0] = true;
	cout << r(0, edges, memo, N) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){

long long n,cnt=0;
 cin>>n;

 string s;
 cin>>s;

 int len = s.length();
  char prev = '$';

  for(int i=0;i<len;i++)
  {
     if(s[i] != prev)
     {
         prev = s[i];
         cnt++;
     }
  }

  cout<<cnt<<endl;

  return 0;
 }

Measured memory_bytes: 3732
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int m=0,n;
    cin >> n;
    vector<int>x(n);
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            m=max(m,abs(x[i]-x[j]));
        }
    }
    cout << m;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main implements Runnable {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 128 * 1024 * 1024).start();
    }

    public void run() {
        int a = sc.nextInt(), b = sc.nextInt();
        System.out.println((a % 2 == 0 || b % 2 == 0) ? "No" : "Yes");
    }
}


Measured memory_bytes: 24404
n,m = map(int,input().split())
s = [[] for _ in range(m)]
k = [0 for _ in range(m)]
for i in range(m):
    k[i],*s[i] = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
sw = [0 for _ in range(n)]
for i in range(int(2**n)):
    on = sw[:]
    cnt = 0
    for j in range(n):
        r = i % 2
        i = i // 2
        if r:
            on[j] += 1
    for j in range(m):
        oncnt = 0
        for x in s[j]:
            oncnt += on[x-1]
        if oncnt % 2 == p[j]:
            cnt += 1
    if cnt == m:
        ans += 1
    #print(on,cnt)
print(ans)

        




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

int main() {
	long long n, r = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			r = r + i;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 3636
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int n = sc.nextInt();
		
		int[] A = new int[n];
		for(int i=0; i<n; i++) {
			A[i] = sc.nextInt();
		}
		
		int x = A[n-1];
		int i = -1;
		int temp;
		for(int j=0; j<=n-2; j++) {
			if(A[j] <= x) {
				i++;
				temp = A[j];
				A[j] = A[i];
				A[i] = temp;
			}
		}
		temp = A[n-1];
		A[n-1] = A[i+1];
		A[i+1] = temp;
		
		StringBuilder ans = new StringBuilder();
		for(int j=0; j<n; j++) {
			if(j != 0) {
				ans.append(" ");
			}
			if(j == i + 1) {
				ans.append("[" + A[j] + "]");
			} else {
				ans.append(A[j]);
			}
		}
		System.out.println(ans);
	}

	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}

}

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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll n;
  string s, t;

  cin >> n;
  cin >> s >> t;

  for (ll i = 0; i < n; ++i) {
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	char a,b;
	cin >> a >>b;
	if(a>b){cout << ">" <<endl;}
	else if(a<b){cout << "<" << endl;}
	else if(a == b){cout << "=" << endl;}
	
	
	return 0;
}


Measured memory_bytes: 256
package main
 
import (
	"fmt"
)
 
func main() {
	var s string
	fmt.Scan(&s)
    count := 0
	if s[0:1] == "1" {
		count++
	}
	if s[1:2] == "1" {
		count++
	}
	if s[2:3] == "1" {
		count++
	}
	fmt.Println(count)
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int> P(N);
    for (int i = 0; i < N; ++i) {
        cin >> P[i];
    }

    int ans = 0;
    for (int i = 0; i < N-2; ++i) {
        int ma = max({P[i], P[i+1], P[i+2]});
        int mi = min({P[i], P[i+1], P[i+2]});
        if (P[i+1] != ma && P[i+1] != mi) ++ans;
    }

    cout << ans << endl;

    return 0;
}


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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var S = cin.Read();
            S = S.Substring(0, S.Length - 1);
            while (S.Length > 1 && !IsEvalString(S))
                S = S.Substring(0, S.Length - 1);
            WriteLine(S.Length);
        }

        public bool IsEvalString(string S)
        {
            var n = S.Length;
            if (n % 2 != 0) return false;
            var s = S.Substring(0, n / 2);
            if (s + s == S) return true;
            return false;
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<string.h>
using namespace std;
char c,s[1000000],s1[1000000];

int main()
{
	int i=0,j,k=0;
	while(c=getchar())
	{
	if(c=='\n') break;
	i++;
	if(i%2==1){k++;s1[k]=c;}
}
for(i=1;i<=k;i++)cout<<s1[i];
return 0;

}	

Measured memory_bytes: 384
group = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
def judge(a, b):
	for i in range(0, len(group)):
		if a in group[i]:
			if b in group[i]: return 'Yes'
			else: return 'No'

x, y = map(int, raw_input().split())
print judge(x, y)

Measured memory_bytes: 2568
# -*- coding: utf-8 -*-
"""


"""


def chmin(i, j):
    a, b = dp[i+j], dp[i]+abs(h[i]-h[i+j])
    if a > b:
        dp[i+j] = b


n, k = map(int, (input().split()))
h = list(input().split())
h = [int(i) for i in h]
dp = [10**10]*n
dp[0] = 0
for i in range(0, n):
    for j in range(1, k+1):
        if i+j < n:
            chmin(i, j)
print(dp[n-1])

Measured memory_bytes: 53216
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
# from bisect import *
# from collections import *
# from heapq import *
# import functools
# import itertools
# import math
INF = float('inf')
MOD = 10**9+7

S = 'SUN,MON,TUE,WED,THU,FRI,SAT'.split(',')
print(7-S.index(input()))


Measured memory_bytes: 38384