akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;

int n, a[1000];

int main() {

	while (true) {
		cin >> n;

		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		sort(a, a + n);

		int Min = INT32_MAX;
		for (int i = 0; i < n - 1; i++) {
			if (a[i + 1] - a[i] < Min) {
				Min = a[i + 1] - a[i];
			}
		}

		cout << Min << endl;
	}
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
#define LL long long int 
#define LD long double
#define PI 3.14159265358979323846
#define MOD ((LL)1e9+7)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N=100+10,W=1e5+10;
LL dp[N][W],wt[N],v[N],n,w;

	
int main()
{
	cin>>n>>w;
	for(LL i=1;i<=n;i++)cin>>wt[i]>>v[i];
	
	for(LL i=0;i<=n;i++)for(LL j=0;j<=w;j++)dp[i][j]=0;
	
	for(LL i=1;i<=n;i++)
	{
		for(LL j=0;j<=w;j++)
		{
			if(wt[i]<=j)
			dp[i][j]=max(dp[i-1][j-wt[i]]+v[i],dp[i-1][j]);
			else
			dp[i][j]=dp[i-1][j];
		}
	}
	cout<<dp[n][w]<<endl;
	
	
	
		
		
}
		


Measured memory_bytes: 80128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int a, b, c;
	std::cin >> a >> b >> c;
	if (a < b && b < c) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3104
def main():
    from collections import Counter
    n, s = int(input()), input()
    c = Counter(s)
    d = list(c.values())
    if len(d) <3:
        print(0)
        exit()
    ans = d[0] * d[1] * d[2]
    rgb = {"R", "G", "B"}
    for i in range(1, n // 2 + 1):
        for j in range(i):
            x = s[j::i]
            for a, b, c in zip(x, x[1:], x[2:]):
                g = {a, b, c}
                if g == rgb:
                    ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9084
#include<stdio.h>
#define min(a,b) ((a)<(b))?(a):(b)
int main(void){
  int n,m,x,t,min=100,i,a=0,b=0;
  scanf("%d%d%d",&n,&m,&x);
  for(i=0;i<m;i++){
    scanf("%d",&t);
    if(t<x){
      a++;
    }else{
      b++;
    }
  }
  printf("%d",min(a,b));
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
string a, b;
int n, m, cnt, res(1e9);
int main() {
    DAU
    cin >> a >> b;
    n = a.size(), m = b.size();
    a = '$' + a;
    b = '$' + b;
    for (int start = 1; start + m - 1 <= n; ++start) {
        cnt = 0;
        for (int i = start; i < start + m; ++i)
            cnt += (a[i] != b[i - start + 1]);
        res = min(res, cnt);
    }
    cout << res;
    PLEC
}


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

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define sz(s) (int)s.size()

int main() {
    unordered_map<int, int> f;
    int n;
    cin >> n;
    rep(i, 0, n) {
        int x;
        cin >> x;
        ++f[x];
        ++f[x - 1];
        ++f[x + 1];
    }
    int ans = 0;
    for (auto it : f) ans = max(ans, it.second);
    cout << ans << '\n';
}

Measured memory_bytes: 4260
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define trace1(x)                  cerr<<#x<<": "<<x<<endl
#define trace2(x, y)               cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
int main() 
{
	ll k,n;
	string s; 
	ll ans=0; 
	cin>>n;
	vector<ll> a(n),b(n),a1(n),b1(n);
	for (int i = 0; i < n; ++i)
	 {
	 	cin>>a[i]; 
	 } 
	 for (int i = 0; i < n; ++i)
	 {
	 	cin>>b[i]; 
	 } 
	 ll x=0,y=0; 
	 a1=a; 
	 b1=b;
	 sort(a1.begin(),a1.end());
     sort(b1.begin(),b1.end());
	 do
	 {
          x++; 
          if(a==a1) 
          	break;
	 }while(next_permutation(a1.begin(), a1.end())); 
	   
	 do
	 {
	 	y++; 
	 	if(b==b1) 
	 		break;

	 }while(next_permutation(b1.begin(), b1.end()));
	ans=abs(x-y);
	cout<<ans;
    return 0;
}

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

int main(){
  int a,b;
  int N;
  vector<int>s,f;

  cin >> a >> b >> N;

  s.resize(N);
  f.resize(N);

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

  
  for(int ix=0;ix<s.size();++ix){
    
    if(s[ix] <= a && a < f[ix]){

      cout << 1 << endl;
      return 0;

    }else if(s[ix] < b && f[ix] >= b){

      cout << 1 << endl;
      return 0;
    }else if (s[ix] >= a && f[ix] <= b){
      cout << 1 << endl;
      return 0;
    }
  }
  
  cout << 0 << endl;
  
  return 0;
}



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

int main() {
	
	int n;
	int c = 0;
	
	cin >> n;
	
	if(n == 1){
		cout << "YES" << endl;
		return 0;
	}
	
	int t;
	for(int i = 0;i < n;i++){
		cin >> t;
		if(t & 1)
			c++;
	}
	
	if(c & 1){
		cout << "NO" << endl;
	}else{
		cout << "YES" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>
#include <complex>

#define INF 100000000
#define EPS 1e-9

using namespace std;

typedef long long ll;  

#define MAX_N 50
#define MAX_P 50

int n, p;

int temoto[MAX_N];

vector<int> ans_list;

int main(){
  
  while(true){
    cin >> n >> p;
    if(n == 0 && p == 0)
      break;

    int sum = p;
    memset(temoto, 0, sizeof(temoto));

    int turn = 0;
    
    while(true){
      if(p > 0){
	temoto[turn%n]++;
	p--;
	if(p == 0 && temoto[turn%n] == sum)
	  break;
      }
      else{
	p += temoto[turn%n];
	temoto[turn%n] = 0;
      }
      turn++;
    }

    ans_list.push_back(turn%n);
    
  }

  for(int i = 0; i < ans_list.size(); i++){
    cout << ans_list[i] << endl;
  }
  
  
  return 0;
  
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
//これがdiff300台ってマジ？怖い
int countCharType(string,string);

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  int ans = 0; //最大の文字種類和
  for(int i = 1; i < n; i++){
    string s1 = s.substr(0,i);
    string s2 = s.substr(i);
    int charType = countCharType(s1,s2);
    ans = max(ans,charType);
  }
  cout << ans << endl;
}

//XとYのどちらにも含まれている文字の種類数(bothExist)を計算
int countCharType(string s1,string s2){
  sort(s1.begin(),s1.end());
  int bothExist = 0;
  rep(i,s1.size()){
    if(i==0){
      if(s2.find(s1[i]) != -1) bothExist++;
    }else{
      if(s1[i] != s1[i-1]){ //Xのi番目とi-1番目の文字が異なる場合、
        if(s2.find(s1[i]) != -1) bothExist++; //i番目の文字がYに存在するか確認
      }
    }
  }
  return bothExist;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;

int main(){
  long long h,w;
  cin >> h >> w;
  long long mi;
  if(h%3==0) mi = 0;
  else mi = w;
  if(w%3==0) mi = 0;
  else mi = min(mi,h);
  REP(x,1,w){
    long long a = h*x;
    long long y = h/2;
    long long b = (w-x) * y;
    long long c = (w-x) * (h-y);
    mi = min(max({a,b,c})-min({a,b,c}),mi);

  }
  REP(y,1,h){
    long long a = w*y;
    long long x = w/2;
    long long b = (h-y) * x;
    long long c = (h-y) * (w-x);
    mi = min(max({a,b,c})-min({a,b,c}),mi);

  }
  cout << mi << endl;
  return 0;
}


Measured memory_bytes: 256
s = int(input())
count = 1


def f(s):
    if s % 2 == 0:
        return s/2
    else :
        return 3*s+1

if s == 1:
    print(4)
elif s == 2:
    print(4)
else:
    while True:

        if s == 4:
            break
        else: 
            s = f(s)
            count += 1

    print(count + 3)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	long long a,b,n;
	cin >> a >> b >> n;
	long long tmp=min(n,b-1); 
	cout << (a*tmp/b-tmp/b*a) << endl;




}

Measured memory_bytes: 3156
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < N; i++) {
            h[i] = sc.nextInt();
        }

        Arrays.sort(h);
        int count = 0;
        for (int i = N - 1; i >= 0; i--) {
            if (h[i] >= K) {
                count++;
            }
            else {
                break;
            }
        }

        System.out.println(count);
    }

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

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

int vertex[100001], n, m, in_deg[100001];
vector< list<int> > bd(100001);

int main() {
	cin >> n >> m;
	memset(in_deg, 0, sizeof(in_deg));
	for (int i=0; i<m; i++) {
		int x, y;
		cin >> x >> y;
		bd[x].push_back(y);
		in_deg[y]++;
	}
	
	queue<int> q;
	for (int i=1; i<=n; i++) {
		if (in_deg[i]==0) {
			q.push(i);
			vertex[i] = 0;
		}	
	}
	
	int ans=0;
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		for (auto itr=bd[u].begin(); itr!=bd[u].end(); itr++) {
			vertex[*itr] = max(vertex[*itr], vertex[u]+1);
			ans = max(ans, vertex[*itr]);
			if (--in_deg[*itr]==0) {
				q.push(*itr);
			}
		}
	}

	cout << ans << "\n";
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d.at(i);
    sort(d.begin(), d.end(), greater<int>());
    int min_size = d.at(0), answer = 1;
    for (int i = 1; i < n; i++)
    {
        if (d.at(i) < min_size)
        {
            min_size = d.at(i);
            answer += 1;
        }
    }
    cout << answer << endl;
}

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

int main(){
  int n;
  cin >> n;
  int num[50][26]={};
  for(int i=0; i<n; i++){
    string s; cin >> s;
    for(int j=0; j<s.size(); j++){
      num[i][s[j]-'a']++;
    }
  }
  string ans="";
  for(int j=0; j<26; j++){
    int m=50;
    for(int i=0; i<n; i++){
      m = min(num[i][j],m);
    }
    for(int i=0; i<m; i++){
      ans+=(char)('a'+j);
    }
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vector<lint> a(n);
    rep(i, n){
        cin >> a[i];
    }
    SORT(a);
    vector<lint> v;
    lint now = 1LL << 32;
    while(now > 1){
        v.push_back(now);
        now >>= 1;
    }
    map<lint, int> mp;
    rep(i, n){
        mp[a[i]] = upper_bound(ALL(a), a[i]) - lower_bound(ALL(a), a[i]);
    }
    a.push_back(LLINF);
    int ans = 0;
    repr(i, n){
        rep(j, v.size()){
            bool flag = false;
            if(*lower_bound(ALL(a), v[j] - a[i]) == v[j] - a[i]){
                if(v[j] - a[i] == a[i]){
                    if(mp[a[i]] >= 2){
                        ++ans;
                        mp[a[i]] -= 2;
                        flag = true;
                    }
                }else{
                    if(mp[a[i]] >= 1 && mp[v[j] - a[i]] >= 1){
                        ++ans;
                        --mp[a[i]];
                        --mp[v[j] - a[i]];
                        flag = true;
                    }
                }
            }
            if(flag){
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 17636
#include <bits/stdc++.h>
#define ll long long

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int inf = 1 << 30;
const int M = 10;
int a[10000][M],b[10000][M];

int main ()
{
    int n;
    cin >> n;
	/*vvi a = vvi(n,vi(M));
	vvi b = vvi(n,vi(M+1));*/
	for (int i = 0;i < n;i++)
        for (int j = 0;j < M;j++)
            cin >> a[i][j];
	for (int i = 0;i < n;i++)
        for (int j = 0;j <= M;j++)
            cin >> b[i][j];
	ll res = -inf;
	for(int i = 1;i < (1<<M);i++) {
		ll tmp = 0;
		for(int j = 0;j < n;j++) {
			int cnt=0;
			for (int k = 0;k < M;k++)
                if ((i&1<<k)&&a[j][k])
                    cnt++;
			tmp += b[j][cnt];
		}
		res = max(res,tmp);
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

  vector<ll> w(N), v(N);
  REP(i, N)
  cin >> w[i] >> v[i];

  int V = accumulate(ALL(v), 0);
  ll dp[N + 1][V + 1];
  REP(i, V + 1)
  dp[0][i] = INF;

  REP(i, N)
  REP(j, V + 1)
  dp[i + 1][j] = min((j <= v[i] ? 0 : dp[i][j - v[i]]) + w[i], dp[i][j]);

  REPR(i, V)
  {
    if (dp[N][i] <= W)
    {
      cout << i << endl;
      break;
    }
  }
  return 0;
}


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

const int mod = 1e9 + 7, mxN = 22;
int N, a[mxN][mxN];
int dp[mxN][1 << mxN];

int rec(int m, int w) {
	if (m == N) {
		if (w == 0)
			return 1;
		return 0;
	}
	if (dp[m][w] != -1)
		return dp[m][w];
	ll tot = 0;
	for (int i = 0; i < N; i++) {
		int woman = 1 << i;
		bool ok = (((w & woman) == 0) ? false : true);
		if (a[m][i] && ok) {
			tot = (tot + rec(m + 1, woman ^ w)) % mod;
		}
	}
	return dp[m][w] = tot;
}

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

	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> a[i][j];
		}
	}
	memset(dp, -1, sizeof(dp));
	int answer = rec(0, (1 << N) - 1);
	cout << answer;

	return 0;
}

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

int main(){
    int n; cin>>n;
    string s; cin>>s;
    vector<int> sum(n+1);
    for(int i=0;i<n;i++){
        sum[i+1]=sum[i]+(int)(s[i]=='#');
    }
    int res=n;
    for(int i=0;i<=n;i++){
        int sc=sum[i]+(n-i)-(sum[n]-sum[i]);
        res=min(res,sc);
    }
    cout<<res<<endl;
    
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> H(N), ma(N);
  rep(i,N) {
    cin >> H[i];
    ma[i] = 0;
  }
  rep(i,M) {
    int A, B;
    cin >> A >> B;
    A--; B--;

    ma[A] = max(ma[A], H[B]);
    ma[B] = max(ma[B], H[A]);
  }
  int ans = 0;
  rep(i,N) {
    if (ma[i] < H[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

typedef long lint;
typedef long long llint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) { return arg1.second < arg2.second; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n, m;
    cin >> n >> m;

    vector<pair<int, int>> ab(m);

    for(int im=0;im<m;im++) {
        cin >> ab.at(im).first >> ab.at(im).second;
        ab.at(im).second--;
    }

    sort(ab.begin(), ab.end(), compPair);
    int ans = 0, abend = 0;
    for(int im=0;im<m;im++) {
        if(ab.at(im).first>abend) {
            abend = ab.at(im).second;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"strings"
)

func main() {
	var N, K int
	var S, r string
	fmt.Scan(&N, &K, &S)
	for i, v := range S {
		if i == K-1 {
			r += strings.ToLower(string(v))
		} else {
			r += string(v)
		}
	}
	fmt.Println(r)
}

Measured memory_bytes: 640
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
count=0
if x in a:
    if y in a:
        count+=1
    else:
        count+=0
if x not in a and x!=2:
    if y not in a and y!=2:
        count+=1
    else:
        count+=0
if x==2:
    if y==2:
        count+=1
    else:
        count+=0
if count!=0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9148
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	int s,k=0;
	cin>>s;
	vector<int> v;
	v.push_back(s);
	map<int,int> mp;
	mp[s]=1;
	while(1){
		if(v[k]%2==0){
			v.push_back(v[k]/2);
			k++;
		}
		else{
			v.push_back((3*v[k])+1);
			k++;
		}
		if(mp[v[k]]!=0){
			break;
		}
		else{
			mp[v[k]]=1;
		}
	}
	cout<<(k+1);
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 1e9

int main(void){
    int N;
    cin>>N;
    vector<vector<ll>> h(N,vector<ll>(3));
    for (int i=0;i<N;i++){
        cin>>h[i][0]>>h[i][1]>>h[i][2];
    }

    vector<vector<ll>> dp(N+2,vector<ll>(3,0));
    
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;

    for (int i=0;i<N;i++){
        for (int j=0;j<3;j++){
            if (dp[i+1][(j+1)%3] < dp[i][j]+h[i][(j+1)%3]){
                dp[i+1][(j+1)%3] = dp[i][j]+h[i][(j+1)%3];
            }
            if (dp[i+1][(j+2)%3] < dp[i][j]+h[i][(j+2)%3]){
                dp[i+1][(j+2)%3] = dp[i][j]+h[i][(j+2)%3];
            }
        }
    }
    ll ans=-1;
    for (int i=0;i<3;i++) if (ans < dp[N][i]) ans = dp[N][i];

    cout<<ans<<endl;

    return 0;
}

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

typedef long long ll;
#define mod 1000000007

vector<vector<int>> adj;

void dfs(int s, vector<bool> &visited, int &sz){
    sz++;
    visited[s] = 1;

    for(int i : adj[s]){
        if(!visited[i])
            dfs(i, visited, sz);
    }
}

int main()
{
    int n, t;
    cin >> n >> t;
    adj.resize(n+1);

    while(t--){
        int i, j;
        cin >> i >> j;
        adj[i].push_back(j);
        adj[j].push_back(i);
    }

    vector<bool> visited(n+1);
    int ans = 0;

    for(int i = 1; i <= n; i++){
        if(!visited[i]){
            int sz = 0;
            dfs(i, visited, sz);
            ans = max(ans, sz);
        }
    }

    cout << ans << "\n";
}

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

int main(){
    ios::sync_with_stdio(false);  cin.tie(NULL);  cout.tie(NULL);
    int n, l, t;    cin >> n >> l >> t; vector<int> vec;
    int say=0;
    for(int i=0;n>i;i++){
        int x, w;   cin >> x >> w;
        if(w==1){
            vec.push_back((t+x)%l); say+=(x+t)/l;
        }
        else{
            say-=(t-x-1+l)/l;   vec.push_back(((x-t)%l+l)%l);
        }
        say=(say+n)%n;
    }
    sort(vec.begin(), vec.end());
    for(int i=say;n>i;i++){
        cout << vec[i] << "\n";
    }
    for(int i=0;say>i;i++){
        cout << vec[i] << "\n";
    }
}


Measured memory_bytes: 1784
#include<stdio.h>
int main(void){
  int a, b;

  scanf("%d%d",&a,&b);

  if (a < b) {
    if (a < b-1) {
      printf("%d\n", b*2-1);
    }else{
      printf("%d\n", a+b);
    }
  }else{
    if (b < a-1) {
      printf("%d\n", a*2-1);
    }else{
      printf("%d\n", a+b);
    }
  }
}


Measured memory_bytes: 1684
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 500005
#define oo 2000000007
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

void read(vector<int> &a) {
    char tmp[maxN];
    scanf("%s", tmp);

    a.resize(strlen(tmp));
    fto(i, 0, sz(a)-1) a[i] = tmp[i]-'0';
}

vector<int> a;
int n;

bool Check(int mid) {
//    debug(mid);
    int cur = 10*mid+a[n-1], mem = 0;
    fdto(i, n-2, 0) {
        int x = a[i]-cur/10-mem;
        int d = (x%10+10)%10;
        mem = (d-x)/10;

        if (d > cur%10) {
            if (cur < 10) return false;
            cur -= 10;
        }
        cur = cur - cur%10 + d;
//        printf("%d %d %d %d %d\n", i, x, d, mem, cur);
    }

    return true;
}

int main () {
    read(a);
    n = sz(a);

//    fto(i, 0, n-1) printf("%d", a[i]);
//    puts("");

    int lo = 0, hi = (n*9-a[n-1])/10, res = hi+1;
    while (lo <= hi) {
        int mid = (lo+hi)/2;
        if (Check(mid)) {
            res = mid;
            hi = mid-1;
        } else lo = mid+1;
    }
//    debug(res);

    printf("%d", (res*10+a[n-1]+8)/9);

    return 0;
}


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

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> cnt(n+1);
	vector<ll> cal(n+1);
	rep(i, n) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	ll sum = 0;
	rep(i, n+1) {
		cal[i] = cnt[i] * (cnt[i]-1) / 2;
		sum += cal[i];
	}
	
	rep(i, n) {
		ll ans = sum - cal[a[i]];
		if(cnt[a[i]]>=2) {
			ll dif = cal[a[i]];
			dif *= cnt[a[i]] - 2;
			dif /= cnt[a[i]];
			ans += dif;
		}
		
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 7296
from collections import deque

n = int(input())

c = 0
q = deque()
for i in range(1, 10):
    q.append(i)

k = 1
while c < n:
    k = q.popleft()
    # print(k)
    if k%10:
        q.append(10*k + k%10 - 1)
    q.append(10 * k + k % 10)
    if k%10 != 9:
        q.append(10*k + (k%10) + 1)
    c += 1

print(k)

Measured memory_bytes: 11908
#include<bits/stdc++.h>
using namespace std;
const int P=1e9+7;
const int N=55;
int n,f[N][N];
long long fac[N],inv[N];
long long fsp(long long x,int y){
	long long ans=1;
	while(y){
		if(y&1)	ans=ans*x%P;
		x=x*x%P,y>>=1;
	}
	return ans;
}
long long C(int n,int m){
	return fac[n]*inv[m]%P*inv[n-m]%P;
}
int main(){
	scanf("%d",&n),fac[0]=inv[0]=1,f[1][1]=f[1][0]=n;
	for(int i=1;i<=n;i++)	fac[i]=fac[i-1]*i%P;
	for(int i=1;i<=n;i++)	inv[i]=fsp(fac[i],P-2);
	for(int i=1;i<n;i++)
		for(int j=1;j<=n-i;j++)
			for(int k=0;k<=j;k++){
				if((j-k)&1)	continue;
				int x=(j-k)/2;
				for(int d=0;d<=j;d++)
					f[i+j][abs(x-d)]=(f[i+j][abs(x-d)]+f[i][k]*C(n-i,j)%P*C(j,d))%P;
			}
	printf("%d\n",f[n][0]);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
    int main(){
        int N, M;
        cin >> N >> M;
            if(N < M){
                for(int tinko = 0; tinko < M; tinko++){
                    cout << N;
                }
            }else if(N > M){
                for(int manko = 0; manko < N; manko++){
                    cout << M;
                }
            }else if(N == M){
                for(int kusokusohanakusomekusomimikuso = 0; kusokusohanakusomekusomimikuso < M; kusokusohanakusomekusomimikuso++){
                    cout << N;                    
                }
            }
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
ll k,a,b;
int main(){
	cin>>k>>a>>b;
	if (b-a>2){
		if (k+1>=a){
			ll x=k+1-a,y=a;
			if (x%2==1){x--;y++;}
			cout<<y+x/2*(b-a)<<endl;
		}else{
			cout<<k+1<<endl;
		}
	}else{
		cout<<k+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
const int N=400005;
struct node
{
	int num,bl,ty;
}a[N];
int n,i,j,k,x,y,c[N];
bool v[N][2];
long long ans=1ll<<60;
bool cmp(node a,node b)
{
	if(a.num!=b.num)
		return a.num<b.num;
	return a.ty<b.ty;
}
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;++i)
	{
		scanf("%d%d",&a[2*i-1].num,&a[2*i].num);
		if(a[2*i-1].num>a[2*i].num)
			swap(a[2*i-1].num,a[2*i].num);
		a[2*i-1].bl=a[2*i].bl=i;
		a[2*i-1].ty=0,a[2*i].ty=1;
	}
	sort(a+1,a+1+2*n,cmp);
	for(i=1;i<=2*n;++i)
		if(a[i].ty==1)
			break;
	if(i-1>=n)
		ans=min(ans,1ll*(a[n].num-a[1].num)*(a[2*n].num-a[n+1].num));
	else
	{
		for(j=i,k=i-1;;++j)
			if(a[j].ty==0)
			{
				++k;
				if(k>=n)
					break;
			}
		ans=min(ans,1ll*(a[j].num-a[1].num)*(a[2*n].num-a[i].num));
	}
	if(a[1].bl!=a[2*n].bl)
	{
		for(x=2;;++x)
			if(a[x].bl==a[1].bl)
				break;
		for(y=2*n-1;;--y)
			if(a[y].bl==a[2*n].bl)
				break;
		if(x>y)
			swap(x,y);
		for(i=2,j=2,k=0;i<2*n;++i)
		{
			while(j<2*n)
			{
				if(c[a[j].bl]==0)
					++k;
				c[a[j].bl]++;
				if(k>=n)
					break;
				++j;
			}
			if(j>=2*n)
				break;
			ans=min(ans,1ll*(a[2*n].num-a[1].num)*(a[max(y,j)].num-a[min(x,i)].num));
			c[a[i].bl]--;
			if(c[a[i].bl]==0)
				--k;
		}
	}
	printf("%lld",ans);
	return 0;
}


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

int main() {
    string S;
    cin >> S;
    cout << ( 
    	  ( S[0] == S[1] && S[2] == S[3] && S[0] != S[2] )
    	||( S[0] == S[2] && S[1] == S[3] && S[0] != S[1] )
    	||( S[0] == S[3] && S[1] == S[2] && S[0] != S[1] )
    	? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
class NetworkFlow
  attr_reader :graph

  Edge = Struct.new(:to, :cap, :rev)
  MAX_V = 20010

  def initialize(n = MAX_V)
    @graph = Array.new(n) { Array.new }
    @level = Array.new(MAX_V)
    @iter = Array.new(MAX_V)
  end

  def add_edge(from, to, cap)
    @graph[from].push(Edge.new(to, cap, @graph[to].size))
    @graph[to].push(Edge.new(from, 0, @graph[from].size - 1))
  end

  def max_flow(s, t)
    flow = 0

    loop do
      bfs(s)
      break if @level[t] < 0
      @iter.fill(0)

      while (f = dfs(s, t, Float::INFINITY)) > 0
        flow += f
      end
    end

    flow
  end

  private

  def bfs(s)
    @level.fill(-1)
    @level[s] = 0

    queue = []
    queue.push(s)

    until queue.empty?
      v = queue.shift

      @graph[v].each do |edge|
        next if edge.cap <= 0
        next if @level[edge.to] >= 0

        @level[edge.to] = @level[v] + 1
        queue.push(edge.to)
      end
    end
  end

  def dfs(v, t, f)
    return f if v == t

    (@iter[v]...@graph[v].size).each do |i|
      @iter[v] = i
      edge = @graph[v][i]

      next if edge.cap <= 0
      next if @level[v] >= @level[edge.to]

      d = dfs(edge.to, t, min(f, edge.cap))
      next if d <= 0

      edge.cap -= d
      @graph[edge.to][edge.rev].cap += d

      return d
    end

    0
  end

  def min(a, b)
    a < b ? a : b
  end
end

N, M = gets.split.map(&:to_i)
S = N.times.map { gets.chomp }

nf = NetworkFlow.new

DY = [-1, 0, 1, 0]
DX = [0, 1, 0, -1]

s = 2 * N * M
t = s + 1

N.times do |y|
  M.times do |x|
    next if S[y][x] == '#'

    u = y * M + x

    if (x + y) % 2 == 0
      nf.add_edge(s, u, 1)

      4.times do |i|
        ny = y + DY[i]
        nx = x + DX[i]
        v = ny * M + nx

        next if ny < 0 || nx < 0 || N <= ny || M <= nx

        nf.add_edge(u, v, 1)
      end
    else
      nf.add_edge(u, t, 1)
    end
  end
end

puts nf.max_flow(s, t)

N.times do |y|
  M.times do |x|
    next if S[y][x] == '#'
    next if (y + x) % 2 != 0

    u = y * M + x

    nf.graph[u].each do |edge|
      next if edge.cap != 0
      next if edge.to >= s

      ny = edge.to / M
      nx = edge.to % M
      v = ny * M + nx

      if (u - v).abs < M
        if x < nx
          S[y][x] = '>'
          S[ny][nx] = '<'
        else
          S[y][x] = '<'
          S[ny][nx] = '>'
        end
      else
        if y < ny
          S[y][x] = 'v'
          S[ny][nx] = '^'
        else
          S[y][x] = '^'
          S[ny][nx] = 'v'
        end
      end
    end
  end
end

puts S


Measured memory_bytes: 22624
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    s = list(sys.stdin.readline().rstrip())
    ans = 0
    for i in range(len(s)):
        if i%2 == 0 and s[i] == "0":
            ans +=1
        elif i%2 == 1 and s[i] == "1":
            ans +=1
    
    ans2 = 0
    for i in range(len(s)):
        if i%2 ==0 and s[i] == "1":
            ans2 +=1
        elif i%2 ==1 and s[i] == "0":
            ans2 +=1
    print(min(ans,ans2))

Measured memory_bytes: 6120
#include<bits/stdc++.h>
main(){
int n,m[4],p[4]={10,50,100,500},x[4],y[4],k,i=0,q,j;
while(true){
std::cin>>n;if(!n){break;}
if(i){printf("\n");}i++;k=0;
std::cin>>m[0]>>m[1]>>m[2]>>m[3];
for(j=3;j>=0;j--){k+=m[j]*p[j];}
q=k-n;
for(j=3;j>=0;j--){x[j]=q/p[j];q-=x[j]*p[j];y[j]=std::max(0,m[j]-x[j]);}
for(j=0;j<4;j++){if(y[j]){printf("%d %d\n",p[j],y[j]);}}
}}

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

#define MAXN 5000005
#define ll long long int

void solve(){
    ll n,x,t;
    cin>>n>>x>>t;
    ll q=n/x;
    ll r=n%x;
    if(r==0){
        cout<<q*t<<endl;
    }else
    cout<<(q+1)*t<<endl;
}
int main(){
    // ll t;
    // cin>>t;
    // while(t--) 
    solve();
    return 0;
}



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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

ll gcd(ll a, ll b) {
    if(b == 0) return a;
    return gcd(b, a%b);
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    
    ll a,b;

    cin>>a>>b;

    ll ans = a*b;

    ans = ans/gcd(a,b);

    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<map>
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define MAXN 100005
#define X first
#define Y second
#define MOD 1000000007
#define inf 1e18
#define fr(a,b,c) for(ll a=b;a<c;++a)
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll t,n,i,j;

int main()
{
    fastio;
    string s,t;
    cin>>s>>t;
    ll cnt=0;
    for(i=0;i<3;i++)
        if(s[i]==t[i])
            cnt++;
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int n,k;
  cin>>n>>k;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i];

  for(Int i=k;i<n;i++)
    cout<<(as[i-k]<as[i]?"Yes":"No")<<newl;

  return 0;
}


Measured memory_bytes: 4780
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 d;

			d = int.Parse(Console.ReadLine());

			if (d == 25)
				Console.WriteLine("Christmas");
			else if (d == 24)
				Console.WriteLine("Christmas Eve");
			else if (d == 23)
				Console.WriteLine("Christmas Eve Eve");
			else if (d == 22)
				Console.WriteLine("Christmas Eve Eve Eve");

			Console.ReadKey();

		}
	}
}


Measured memory_bytes: 13140
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,v,u) for(int i=last[v],u=to[last[v]];i;i=nxt[i],u=to[i])
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
void read(int &n)
{
	int t=0,p=1;char ch;
	for(ch=getchar();!('0'<=ch && ch<='9');ch=getchar())
		if(ch=='-') p=-1;
	for(;'0'<=ch && ch<='9';ch=getchar()) t=t*10+ch-'0';
	n=t*p;
}
const int N=4e5+5,M=50000005;
int n,nn,rtn,tot,ext,b[N][2];
struct node
{
	int x,id;
}a[N];
bool cmp(node a,node b){return a.x<b.x;}
int m,co[N],to[M],nxt[M],last[N],list[N],L[N],R[N];
void link(int u,int v)
{
	to[++m]=v,nxt[m]=last[u],last[u]=m;
}
bool dfs(int v)
{
	if(v<=tot && co[v^1]) return 0;
	if(v<=tot && co[v]) return 1;
	co[v]=1;
	list[++list[0]]=v;
	efo(i,v,u) if(!co[u])
		if(!dfs(u)) return 0;
	return 1;
}
bool check(int lim)
{
	m=0;mset(last,0);
	fo(i,1,n)
	{
		link(b[i+i-1][0],b[i+i][1]),link(b[i+i][1],b[i+i-1][0]);
		link(b[i+i-1][1],b[i+i][0]),link(b[i+i][0],b[i+i-1][1]);
	}
	fo(i,1,rtn)
		fo(j,L[i],R[i]) link(tot+i,b[a[j].id][0]);
	int l=1,r=1;
	fo(i,1,nn)
	{
		while(l<nn && a[i].x-a[l].x>=lim) ++l;
		while(r<nn && a[r+1].x-a[i].x<lim) ++r;
		int ql=min(rtn,(l-1)/rtn+1),qr=min(rtn,(r-1)/rtn+1),qi=min(rtn,(i-1)/rtn+1);
		if(ql==qr)
		{
			fo(j,l,r)
				if(j!=i) link(b[a[i].id][1],b[a[j].id][0]);
		}
		else
		{
			if(ql==qi)
				fo(j,l,i-1) link(b[a[i].id][1],b[a[j].id][0]);
			else
			{
				fo(j,l,R[ql]) link(b[a[i].id][1],b[a[j].id][0]);
				fo(j,ql+1,qi-1) link(b[a[i].id][1],tot+j);
				fo(j,L[qi],i-1) link(b[a[i].id][1],b[a[j].id][0]);
			}
			if(qi==qr)
				fo(j,i+1,r) link(b[a[i].id][1],b[a[j].id][0]);
			else
			{
				fo(j,i+1,R[qi]) link(b[a[i].id][1],b[a[j].id][0]);
				fo(j,qi+1,qr-1) link(b[a[i].id][1],tot+j);
				fo(j,L[qr],r) link(b[a[i].id][1],b[a[j].id][0]);
			}
		}
	}
	mset(co,0);
	fo(i,1,tot)
	{
		int x=i+i-1;
		if(!co[b[x][0]] && !co[b[x][1]])
		{
			list[0]=0;
			if(!dfs(b[x][0]))
			{
				fo(j,1,list[0]) co[list[j]]=0;
				list[0]=0;
				if(!dfs(b[x][1])) return 0;
			}
		}
	}
	return 1;
}
namespace Prog2{
	const int N = 10010;
	int m=0,n;
	int v[N<<1],f[N<<1];
	inline bool ok(int x){
		v[0]=-1e9;
		memset(f,0,sizeof f); f[0]=0;
		int j=1;
		for(int i=1;i<=m;++i){
		//	j=lower_bound(v,v+1+m,v[i]-x)-v;
			while(v[j]<=v[i]-x) ++j;
			if (v[j]>v[i]-x) --j;
			f[i]=max(f[i-1],f[j]+1);
		}
		return f[m]>=n;
	}
}
int main()
{
	int x,y;
	read(n);nn=n+n; Prog2::n=n;
	fo(i,1,n) read(a[i+i-1].x),read(a[i+i].x),Prog2::m+=2;
	tot=1;
	fo(i,1,nn) a[i].id=i,b[i][0]=++tot,b[i][1]=++tot;
	rtn=sqrt(nn);
	fo(i,1,rtn-1) L[i]=1+rtn*(i-1),R[i]=rtn*i;
	L[rtn]=1+rtn*(rtn-1),R[rtn]=nn;
	sort(a+1,a+nn+1,cmp);
	fo(i,1,n+n) Prog2::v[i]=a[i].x;
	int l=0,r=a[nn].x;
	while (l<r-1){
		int M=(l+r)>>1;
		if(Prog2::ok(M)) l=M;
		else r=M;
	}
	l=0;
	while(l<r-1)
	{
		int mid=(l+r)>>1;
		if(check(mid)) l=mid;
		else r=mid;
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 41344
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    ll s,t,d;
    cin>>s>>t>>d;
    ll aim = s-t;
    vector<ll> w(d);
    for(ll i=0;i<d;i++)cin>>w[i];
    ll sumw = w[0];
    vector<ll> dp(d,0);
    dp[0] = w[0];
    for(ll i=1;i<d;i++)sumw += w[i],dp[i] = dp[i-1] + w[i];
    ll mi = inf;
    for(ll i=0;i<d;i++){
	if( aim + dp[i] <= 0 ){
	    cout<<i+1<<endl;
	    return 0;
	}
	mi =  min( mi , dp[i] );
    }
    if( sumw >= 0 ){
	cout<<-1<<endl;
	return 0;
    }
    mi = abs( mi );
    ll res = ( aim - mi )/(-sumw) ;
    aim += res *  sumw ;
    res *= d;
    while( aim  > 0 ){
	aim +=w[ res % d ];
	res++;
    }
    cout<<res<<endl;

    return 0;
}



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

int main(){
  char X;
  cin >> X;
  if((X=='a')||(X=='e')||(X=='i')||(X=='o')||(X=='u')){
  cout << "vowel" << endl;
  }else{
  cout << "consonant" << endl;  
  }
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
x.sort()
ans = float("inf")

for i in range(x[0], x[-1]+1):
    t = 0
    for q in range(n):
        t += (i - x[q]) ** 2
    else:
        if ans > t:
            ans = t

print(ans)

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

typedef long long ll;

ll gcd(
  ll a
  , ll b
)
{
  auto r = a%b;
  a = b;
  b = r;
  while (0 != b)
  {
  	r = a%b;
    a = b;
    b = r;
  }
  return a;
}

ll lcm(
  ll a
  , ll b
)
{
  return a*b/gcd(a, b); 
}

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<ll> a(N);
  for (auto & _a : a)
    cin >> _a;
  sort(a.rbegin(), a.rend());
  a.erase(unique(a.begin(), a.end()), a.end());
  auto _mod = a[0]/2%2;
  for (ll i = 1; i < N; ++i)
  {
    if (a[i]/2%2 != _mod)
    {
      cout << 0;
      return 0;
    }
  }
  auto min_X_max_a = a[0]/2;
  for (; min_X_max_a <= M; min_X_max_a += a[0])
  {
    ll j = 1;
    for (; j < N; ++j)
      if (0 != ((min_X_max_a - a[j]/2)%a[j]))
        break;
    if (N == j)
      break;
  }
  if (M < min_X_max_a)
  {
    cout << 0;
    return 0;
  }
  auto _lcm = a[0];
  for (ll i = 1; i < N; ++i)
    _lcm = lcm(_lcm, a[i]);
  cout << (M - min_X_max_a)/_lcm + 1;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define ll long long

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<ll> k(n, 0);
    rep(i, n)
    {
        cin >> a[i];
        k[a[i] - 1]++;
    }
    ll sum = 0;
    rep(i, n)
    {
        sum += (k[i] * (k[i] - 1)) / 2;
    }
    rep(i, n)
    {
        ll ssum = sum;
        ssum -= k[a[i] - 1] - 1;
        cout << ssum << endl;
    }
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int r;
    cin >> r;
    printf("%.5f\n",(double) r * 2 * M_PI);
    return 0;
}

Measured memory_bytes: 3708
num = list(map(int, input().split()))
A = input()

class Dice:
    def __init__(self, num):
        self.state = {}
        for i in range(1,6+1):
            self.state[i] = num[i-1]
        
    def action(self, a):
        new_state = self.state.copy()
        if a=='E':
            new_state[1] = self.state[4]
            new_state[4] = self.state[6]
            new_state[6] = self.state[3]
            new_state[3] = self.state[1]
        elif a=='N':
            new_state[1] = self.state[2]
            new_state[2] = self.state[6]
            new_state[6] = self.state[5]
            new_state[5] = self.state[1]
        elif a=='S':
            new_state[1] = self.state[5]
            new_state[5] = self.state[6]
            new_state[6] = self.state[2]
            new_state[2] = self.state[1]
        elif a=='W':
            new_state[1] = self.state[3]
            new_state[3] = self.state[6]
            new_state[6] = self.state[4]
            new_state[4] = self.state[1]
        self.state = new_state
    
dice = Dice(num)
for a in A:
    dice.action(a)

print(dice.state[1])


Measured memory_bytes: 5608
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e5;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
int h[INF];
int main()
{
    int n, k;
    cin >> n >> k;
    repi(i, n, 0)
    {
        cin >> h[i];
    }
    int ans = 0;
    repi(i, n, 0)
    {
        if (h[i] >= k)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Alhamdulillah return 0;
#define loop(i,k,n) for (ll i = k ; i < n ; ++i)
#define all(v) v.begin(),v.end()
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl

void Suhaib_Sawalha (){

    string s[4] = {"AC" , "WA" , "TLE" , "RE"};
    string w;
    int n;
    cin >> n;
    map <string,int> m;
    while (n--){
        cin >> w;
        m[w]++;
    }

    for (int i = 0 ; i < 4 ; ++i){
        cout << s[i] << " x " << m[s[i]] << '\n';
    }

}

int main(){
                                In_The_Name_Of_Allah_The_Merciful   /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
    freopen("SuhaibSawalha1.txt","r",stdin);
#endif
//int _;for(cin>>_;_;--_,cout<<'\n')
        Suhaib_Sawalha();
                                         Alhamdulillah                    /* الحمد لله */
}


Measured memory_bytes: 3644
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
//ios::sync_with_stdio(false);
//<< setprecision(5)
const int mod=1000000007;
const long double big=1e7+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	ios::sync_with_stdio(false);
	int a,b,c;cin>>a>>b>>c;
	if(a==b){cout<<c<<endl;}
	if(a==c){cout<<b<<endl;}
	if(b==c){cout<<a<<endl;}
	return 0;
}


Measured memory_bytes: 888
n = int(input())
a = list(map(int,input().split()))

cnt = [0] * 1000005
for x in a:
    if cnt[x] != 0: 
        cnt[x] = 2
    else: 
        for i in range(x,1000005,x):
            cnt[i] += 1

ans = 0
for x in a:
    if cnt[x] == 1:
        ans += 1

print(ans)


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

#define SZ(x) ((int(x.size())))

typedef long long ll;
typedef long double ld;

using namespace std;

const int mod = 1000000007, maxn = 4*1000+10, O = 2005;
ll ans, kam, fac[2 * maxn], caf[2 * maxn];
int n, a, b, dp[maxn][maxn], mark[maxn][maxn];

ll power (ll a, ll b, int m)
{
    if (b == 0)
        return 1;
    ll kmk = power (a, b / 2, m);
    if (b & 1)
        return (((kmk * kmk) % m) * a) % m;
    return (kmk * kmk) % m;
}

void make_fac ()
{
    fac[0] = 1;
    for (int i = 1; i < 2 * maxn; i++)
        fac[i] = (fac[i - 1] * i) % mod;
}

void make_caf ()
{
    for (int i = 0; i < 2 * maxn; i++)
        caf[i] = power (fac[i], mod - 2, mod);
}

ll C (int R, int N)
{
    return (((fac[N] * caf[R]) % mod) * caf[N - R]) % mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    make_fac ();
    make_caf ();
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        kam = (kam + C (2 * a, 2 * (a + b))) % mod;
        dp[O - a][O - b]++;
        mark[O + a][O + b]++;
    }
    for (int i = 1; i < maxn; i++)
    {
        for (int j = 1; j < maxn; j++)
        {
            dp[i][j] = (((dp[i][j] + dp[i - 1][j]) % mod) + dp[i][j - 1]) % mod;
            ans = (ans + (((ll)dp[i][j] * mark[i][j]) % mod)) % mod;
        }
    }
    cout << (((ans + mod - kam) % mod) * power (2, mod - 2, mod)) % mod;
	return 0;
}

Measured memory_bytes: 95360
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<unsigned char, unsigned char> pcc;
typedef pair<double, double> pdd;
typedef vector<vector<ll>> matrix;

void dfs(set<string>& ret, string s) {
  if(ret.count(s)) return;
  ret.insert(s);
  for(int i = 0; i + 1 < s.size(); i++) {
    if(s[i] == s[i+1]) continue;
    char ch = 'a';
    while(s[i] == ch || s[i+1] == ch) ch++;
    dfs(ret, s.substr(0, i) + ch + "" + ch + "" + s.substr(i+2, s.size()-i-2));
  }
}

void bruteforce(string s) {
  set<string> ret;
  dfs(ret, s);
  cout << ret.size() << "\n";
  exit(0);
}

int dp[3][3][2];
int ndp[3][3][2];
const int MOD = 998244353;
void solve() {
  string s;
  cin >> s;
  if(s.size() <= 6) {
    bruteforce(s);
  }
  bool allSame = true;
  for(int i = 1; i < s.size(); i++) {
    allSame &= s[i] == s[i-1];
  }
  if(allSame) {
    cout << "1\n";
    return;
  }
  int sum = 0;
  bool allDistinct = true;
  for(int i = 0; i + 1 < s.size(); i++) {
    if(s[i] == s[i+1]) allDistinct = false;
  }
  for(int i = 0; i < s.size(); i++) {
    sum += s[i] - 'a';
  }
  sum %= 3;
  for(int x = 0; x < 3; x++) {
    dp[x][x][0] = 1;
  }
  for(int qq = 1; qq < s.size(); qq++) {
    memset(ndp, 0, sizeof(ndp));
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        for(int k = 0; k < 2; k++) {
          for(int a = 0; a < 3; a++) {
            ndp[(i+a)%3][a][k | (j == a)] += dp[i][j][k];
            ndp[(i+a)%3][a][k | (j == a)] %= MOD;
          }
        }
      }
    }
    memcpy(dp, ndp, sizeof(dp));
  }
  int ret = allDistinct;
  ret += dp[sum][0][1];
  ret %= MOD;
  ret += dp[sum][1][1];
  ret %= MOD;
  ret += dp[sum][2][1];
  ret %= MOD;
  cout << ret << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ":" << "\n";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


Measured memory_bytes: 720