akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<string> S = new List<string>();
            int AC = 0;
            int WA = 0;
            int TLE = 0;
            int RE = 0;
            for(int i = 0;i < N; i++)
            {
                S.Add(Console.ReadLine());
            }
            for (int i = 0; i < N; i++)
            {
                if (S[i] == "AC")
                {
                    AC++;
                }
                else if (S[i] == "WA")
                {
                    WA++;
                }
                else if (S[i] == "TLE")
                {
                    TLE++;
                }
                else if (S[i] == "RE")
                {
                    RE++;
                }
            }
            Console.WriteLine("AC x "  + AC);
            Console.WriteLine("WA x "  + WA);
            Console.WriteLine("TLE x " + TLE);
            Console.WriteLine("RE x "  + RE);
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 32744
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;

const int INF = 1001001001;

int main() {
  int h, n;
  cin >> h >> n;
  vi a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];

  vi dp(h+1, INF);
  dp[0] = 0;
  rep(i, n){
    rep(j, h+1){
      if (j <= a[i]) dp[j] = min(dp[j], b[i]);
      else dp[j] = min(dp[j], dp[j - a[i]] + b[i]);
    }
  }
  cout << dp[h] << endl;
  return 0;
}

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

struct Map {
	std::vector<bool> data; // true ????????¶
	int width;
	int height;

	void initialize(int width, int height) {
		this->width = width;
		this->height = height;
		data.resize(width * height);
	}

	bool is_ground(int x, int y) {
		return data[y * width + x];
	}

	void set_as_sea(int x, int y) {
		data[y * width + x] = false;
	}
};

void paint(Map& map, int x, int y) {
	if (x < 0 || x >= map.width || y < 0 || y >= map.height) return;
	if (!map.is_ground(x, y)) return;

	map.set_as_sea(x, y);

	paint(map, x - 1, y - 1);
	paint(map, x - 1, y);
	paint(map, x - 1, y + 1);
	paint(map, x, y - 1);
	paint(map, x, y + 1);
	paint(map, x + 1, y - 1);
	paint(map, x + 1, y);
	paint(map, x + 1, y + 1);
}

int main()
{
	Map map;

	while (true) {
		int w, h;
		std::cin >> w >> h;

		if (w == 0) return 0;

		map.initialize(w, h);

		for (int i = 0; i < w * h; i++) {
			int c;
			std::cin >> c;
			map.data[i] = c == 1;
		}

		int count = 0;

		for (int y = 0; y < h; y++) {
			for (int x = 0; x < w; x++) {
				if (map.is_ground(x, y)) {
					count++;
					paint(map, x, y);
				}
			}
		}

		std::cout << count << std::endl;
	}
}

Measured memory_bytes: 3108
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string.h>
#include<limits.h>
#include<string> 
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map> 
#include<set>
using namespace std;
int main(void) {
	string str;
	cin >> str;
	printf("%c\n",str[0] + 1);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    ll H;
    int N;
    cin >> H >> N;

    vector<ll> v(N);

    for(int i = 0; i < N; i++) cin >> v[i];

    ll sum = 0;
    for (size_t i = 0; i < N; i++)
    {
        sum += v[i];
    }
    

    if(  sum >= H ) cout << "Yes" << endl;
    else cout << "No" << endl;
 
}

Measured memory_bytes: 1024
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;



int dp[100005];
int main(){
    IOS
    //freopen("output.txt","w",stdout);
    int n,k;
    cin>>n>>k;

    vector<int>A;

    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        A.push_back(a);
    }



    for(int remstone = 0 ; remstone<=k; remstone++){
        for(int i=0;i<A.size();i++){
            int x = A[i];

            if(x>remstone)continue;

            if(dp[remstone-x]==0){
                dp[remstone]=1;
            }
        }
    }

    if(dp[k]==1)    cout<<"First\n";
    else            cout<<"Second\n";
}


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

long long gcd(long long a, long long b) {
	if (a < 0) a = -a;
	if (b < 0) b = -b;
	while (a != 0) {
		long long tmp = b % a;
		b = a;
		a = tmp;
	}
	return b;
}

vector<pair<long long, int>> prime_factorization(long long n) {
	vector<pair<long long, int>> v;
	for (long long i = 2; i * i <= n; ++i) {
		int e = 0;
		while (n % i == 0) {
			++e;
			n /= i;
		}
		if (e != 0) v.emplace_back(i, e);
	}
	if (n != 1) v.emplace_back(n, 1);
	return v;
}

int main() {
	long long a, b;
	cin >> a >> b;
	auto v = prime_factorization(gcd(a, b));
	long long ans = 1 + v.size();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
import java.awt.geom.Point2D;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
	static Scanner in = new Scanner(System.in);
	final double EPS=1.0e-8;
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new B().doIt();
	}
	
	class B{
		
		int h;
		int[][] field;
		int point;
		void doIt(){
			
			while(true){
				h = in.nextInt();
				if(h == 0)return;
				field = new int[h][5];
				for(int i=0;i<h;i++)for(int s=0;s<5;s++)field[i][s] = in.nextInt();
				point = 0;
				play();
			}
		}
		
		void play(){
			while(true){
				int plusPoint = deleteStone();
				if(plusPoint == 0)break;
				point += plusPoint;
				fixField();
//				print();
			}
			System.out.println(point);
		}
		
		void fixField(){
			for(int x=0;x<5;x++){//watch tate
				for(int y=h-1;y>=0;y--)if(field[y][x] < 0){
					for(int dy = y-1;dy >= 0; dy--)if(field[dy][x] > 0){
						int hoge = field[dy][x];
						field[dy][x] = field[y][x];
						field[y][x] = hoge;
						break;
					}
				}
			}
		}
		
		int deleteStone(){
			int p = 0;
			for(int i=0;i<h;i++)p += deleteLine(i);
			return p;
		}
		
		int deleteLine(int y){
			int count = 0;
			int targetNumber = field[y][2];
			if(targetNumber == -1)return 0;
			
			if(field[y][1] == targetNumber && field[y][3] == targetNumber
					&&field[y][0] == targetNumber && field[y][4] == targetNumber){
				count=5;
				field[y][0] = field[y][1] = field[y][2] = field[y][3] = field[y][4] = -1;
			}else if(field[y][0] == targetNumber && field[y][1] == targetNumber && field[y][3] == targetNumber
					 ){
				count=4;
				field[y][0] = field[y][1] = field[y][2] = field[y][3] = -1;
			}else if(field[y][1] == targetNumber && field[y][3] == targetNumber
					&& field[y][4] == targetNumber){
				count=4;
				field[y][1] = field[y][2] = field[y][3] = field[y][4] = -1;
			}else if(field[y][1] == targetNumber && field[y][3] == targetNumber
					){
				count=3;
				 field[y][1] = field[y][2] = field[y][3] = -1;
			}else if(field[y][1] == targetNumber &&field[y][0] == targetNumber){
				count=3;
				field[y][0] = field[y][1] = field[y][2] = -1;
			}else if(field[y][3] == targetNumber && field[y][4] == targetNumber){
				count=3;
				field[y][2] = field[y][3] = field[y][4] = -1;
			}
			
			return count * targetNumber;
		}
		
		void print(){
			System.out.println();
			for(int i=0;i<h;i++){
				for(int s=0;s<5;s++)System.out.print(field[i][s]+" ");
				System.out.println();
			}
		}
	}
	
}

Measured memory_bytes: 49924
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	string s;
	cin >> s;
	if (s == "ABC")
		cout << "ARC";
	else cout << "ABC";


		          return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t a;
    string s;
    cin >> a >> s;
    if (a >= 3200) {
        cout  << s << endl;
    } else {
        cout << "red" << endl;
    }
}


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

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
	int K,S;
	cin >> K >> S;

	ll ans = 0;

	for (int x = 0; x <= K; x++){
		for (int y = 0; y <= K ; y++){
			int z = S-x-y;
			if (z >= 0 && z <= K)
			{
				ans++;
				//cout << x << ":" << y << ":" << z << endl;
			}

		}
	}	
	cout << ans << endl;

	return 0;
}

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

int main(){
    int a[6];
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
    //未知をたどることで全ての街にたどり着けることはしられているからハブがないかを調べる

    if(  ((a[0]-a[2])*(a[0]-a[3]) == 0) && ((a[0]-a[4])*(a[0]-a[5]) == 0)) cout << "NO" << endl;
    else if(  ((a[1]-a[2])*(a[1]-a[3]) == 0) && ((a[1]-a[4])*(a[1]-a[5])) == 0) cout << "NO" << endl;
    else if(  ((a[2]-a[1])*(a[2]-a[0]) == 0) && ((a[2]-a[4])*(a[2]-a[5]) == 0)) cout << "NO" << endl;
    else if(  ((a[0]-a[3])*(a[1]-a[3]) == 0) && ((a[3]-a[4])*(a[3]-a[5]) == 0)) cout << "NO" << endl;
    else if(  ((a[4]-a[2])*(a[4]-a[3]) == 0) && ((a[1]-a[4])*(a[0]-a[4]) == 0)) cout << "NO" << endl;
    else if(  ((a[0]-a[5])*(a[1]-a[5]) == 0) && ((a[3]-a[5])*(a[2]-a[5]) == 0)) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    vector<float> v(N);
    for(int i=0;i<N;i++) cin >> v.at(i);
    for(int i=0;i<N-1;i++){
        sort(v.begin(),v.end());
        v.at(1) = (v.at(0)+v.at(1))/2.0;
        v.erase(v.begin());
    }
    cout << v.at(0) << endl;
}


Measured memory_bytes: 256
import sys

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, M = MI()
mod = 10**9 + 7
stairs = [1] + [0] * N
safe = [True] * (N + 1)

for _ in range(M):
    a = int(input())
    safe[a] = False

if safe[1]:
    stairs[1] = 1

for i in range(2, N + 1):
    if not safe[i - 1] and not safe[i - 2]:
        print(0)
        sys.exit()
        
    if safe[i - 1]:
        stairs[i] += stairs[i - 1]
    
    if safe[i - 2]:
        stairs[i] += stairs[i - 2]
    
    stairs[i] %= mod

print(stairs[N])

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

namespace AOJ.Codes
{
    class ITP1_1_C_Rectangle
    {
        static void Main(string[] args)
        {
            //読み込み
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = x[0];
            var b = x[1];

            //計算
            var area = a * b;
            var len = 2 * (a + b);

            //出力
            Console.WriteLine(area + " " + len);

            //Enterを押して終了
            Console.ReadLine();
        }
    }
}



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

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

  for (int i = 0; i<N; i++) {
    cin >> A;

    if (A % 2 == 0) {
      if ((A % 3 != 0) && (A % 5 != 0)) {
        cout << "DENIED" << endl;
	return 0;
      }
    }

  }

  cout << "APPROVED" << endl;

  return 0;
}


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

using namespace std;

int N, A, B, used[100], rings[100], G[100][199];

int rec(int pos)
{
	int ret = 1; used[pos] = 1;

	for(int i = 0; i < rings[pos]; i++)
	{
		if(!used[G[pos][i]])
		{
			ret = max(ret, rec(G[pos][i]) + 1);
		}
	}

	used[pos] = 0;

	return ret;
}

int main()
{
	int N, A, B;

	while(true)
	{
		scanf("%d", &N);
 
		if(N == 0) { break; }

		for(int i = 0; i < 100; i++)
		{
			used[i] = 0; rings[i] = 0;
		}

		for(int i = 0; i < N; i++)
		{
			scanf("%d", &A); A--;
			scanf("%d", &B); B--;

			G[A][rings[A]] = B; rings[A]++;
			G[B][rings[B]] = A; rings[B]++;
		}

		int nodes = 0;

		for(int i = 0; i < 100; i++)
		{
			if(rings[i])
			{
				nodes++;
			}
		}

		int ret = 0;

		for(int i = 0; i < 100; i++)
		{
			ret = max(ret, rec(i));

 			if(ret == nodes) break;
		}
 
		printf("%d\n", ret);
	}

	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, x;
  cin >> N >> x;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  sort(A.begin(), A.end());
  int res = 0;
  for (int i = 0; i < N; i++) {
    if (i == N - 1 and x - A[i] != 0) break;
    if (x - A[i] < 0) break;
    x -= A[i];
    res++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int q;
  cin>>q;
  deque<int>d;
  while(q--){
    int t;
    cin>>t;
    if(t==0){
      int x,y;
      cin>>x>>y;
      if(x==0)d.push_front(y);
      else d.push_back(y);
    }else if(t==1){
      int p;
      cin>>p;
      cout<<d[p]<<endl;
    }else{
      int x;
      cin>>x;
      if(x==0)d.pop_front();
      else d.pop_back();
    }
  }
  return 0;
}



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

int main() {
    int h, w;
    cin >> h >> w;

    rep(i, w + 2) cout << '#';
    cout << endl;
    rep(i, h) {
        cout << '#';
        rep(j, w) {
            char a;
            cin >> a;
            cout << a;
        }
        cout << '#' << endl;
    }
    rep(i, w + 2) cout << '#';
    cout << endl;

    return 0;
}


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

int main(){
  int n,x;
  cin>>n>>x;
  int m[n]={0},mx=100000;
  for(int i=0;i<n;i++){
    cin>>m[i];
    x-=m[i];
    mx=min(mx,m[i]);
  }
  int ans=n;
  ans+=x/mx;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
x,k,d=map(int,input().split())

if x==0 and k%2==0:print(0)
if x==0 and k%2==1:print(d)

if x>0 and x>=k*d:print(x-k*d)
if x>0 and x<k*d:
    if ((x-x%d)//d)%2==k%2:print(x%d)
    else:print(abs(x%d-d))
if x<0 and -x>=k*d:print(-x-k*d)
if x<0 and -x<k*d:
    if ((abs(x)-abs(x)%d)//d)%2==k%2:print(-x%d)
    else:print(abs(-x%d-d))

Measured memory_bytes: 9144
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
  int A,B,m;
  string ans;
  cin >> A >> B;
  if (A<=B){
  if (A<=B)
    m = A;
  else
    m = B;
  }else
    m = A - 1;
  cout << m <<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100001;

string s;
bitset<18001> b1;
bitset<18001> b2;
int main() {
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  cin >> s;
  int v = 0;
  int len = 0;

  vector<int> m[2];
  for(int i = 0;i < s.size();i++){
    if(s[i] == 'T'){
      m[v].push_back(len);
      len = 0;
      v ^= 1;
    }else{
      len++;
    }
  }
  m[v].push_back(len);

  int x, y;
  cin >> x >> y;
  b1[(m[0].size() ? m[0][0] : 0) + 9000] = 1;
  b2[9000] = 1;
  for(int i = 1;i < m[0].size();i++){
    b1 = (b1 >> m[0][i]) | (b1 << m[0][i]);
  }
  for(int i = 0;i < m[1].size();i++){
    b2 = (b2 >> m[1][i]) | (b2 << m[1][i]);
  }
  if(b1[x + 9000] && b2[y + 9000]){
    cout << "Yes\n";
  }else{
    cout << "No\n";
  }
  return 0;
}


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

int p[200001];

int main(){
    int n,k; cin >> n >> k;
    for(int i=0;i<n;i++) cin >> p[i];
    int biggest=0;
    int current=0;
    for(int i=0;i<k;i++) current+=p[i];
    biggest=current;
    for(int i=k;i<n;i++){
        current-=p[i-k];
        current+=p[i];
        if(biggest<current) biggest=current;        
    }
    cout<<fixed<<setprecision(10);
    cout << (double(biggest)+double(k))/2.0 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int n;
LL dp[N][3][3];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	string s1, s2;
	int n;
	cin >> n;
	cin >> s1 >> s2;
	int cur = 0;
	if (s1[0] == s2[0])
	{
		for (int i = 0; i < 3; i++) dp[0][i][i] = 1;
		cur = 1;
	}
	else
	{
		for (int i = 0; i < 3; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				if (i == j) continue;
				dp[1][i][j] = 1;
			}
		}
		cur = 2;
	}
	for (int i = cur; i < n; i++)
	{
		if (s1[i] == s2[i])
		{
			for (int j = 0; j < 3; j++)
			{
				for (int o1 = 0; o1 < 3; o1++)
				{
					for (int o2 = 0; o2 < 3; o2++)
					{
						if (o1 == j) continue;
						if (o2 == j) continue;
						auto &tmp = dp[i][j][j] += dp[i - 1][o1][o2];
						if (tmp >= INF) tmp -= INF;
					}
				}
			}
		}
		else
		{
			i++;
			for (int j = 0; j < 3; j++)
			{
				for (int k = 0; k < 3; k++)
				{
					if (j == k) continue;
					for (int o1 = 0; o1 < 3; o1++)
					{
						if (o1 == j) continue;
						for (int o2 = 0; o2 < 3; o2++)
						{
							if (o2 == k) continue;
							auto &tmp = dp[i][j][k] += dp[i - 2][o1][o2];
							if (tmp >= INF) tmp -= INF;
						}
					}
				}
			}
		}
	}
	LL ans = 0;
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			ans += dp[n - 1][i][j];
		}
	}
	cout << ans % INF << endl;

	return 0;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n, m;
    while (cin >> n >> m, n, m) {
        vector<int> v(n);
        map<double, double> mp;
        rep(i, n) {
            cin >> v[i];
            int idx = v[i] / m;
            mp[idx]++;
        }
        double ans = 0;
        double ma = 0;
        double sz = 0;
        for (auto t : mp) {
            ma = max(ma, t.second);
            sz = max(sz, t.first);
        }
        for (auto t : mp) {
            ans += ((sz-t.first)/sz)*(t.second/ma);
        }
        printf("%.10f\n", ans+0.01);
    }
    return 0;
}



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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d) {
    cout << "Left" << endl;
  }
  else if (a + b == c + d) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
    char b;
    cin >> b;
    switch(b){
        case 'A': cout<<'T'<<endl; break;
        case 'T': cout << 'A' << endl;break;
        case 'G': cout << 'C'<<endl; break;
        case 'C': cout << 'G' <<endl; break;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define test(a) cout << " " << (a) << " "
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// typedef pair<int,int> P;

const int MAXN = 1e5 + 10;
const int INF = 0x3f3f3f3f;

int n, k, t, m, tot, P[25];
struct Node {
	int u, v, w;
	Node() {}
	Node(int u, int v, int w):u(u),v(v),w(w) {}
} ans[100];

void pre_calc (int up) {
	P[1] = 1;
	for (int i = 2; i < up; i++) P[i] = P[i-1]<<1;
}

int main (void) {
    // freopen("input.txt","r",stdin);
    // ios::sync_with_stdio(false);
    // cin.tie(0); cout.tie(0);

	pre_calc(21);
	scanf("%d", &n);
	int m = n, k = 0;
	n--;
	while (m >= 2) {
		m /= 2;
		k++;
		ans[++tot] = Node(k,k+1,0);
		ans[++tot] = Node(k,k+1,P[k]);
	}
	n -= 2*P[k]-1;
	t = 2*P[k];
	for (int i = 20; i > 0; i--) {
		if (n >= P[i]) {
			n -= P[i];
			ans[++tot] = Node(i,k+1,t);
			t += P[i];
		}
	}
	printf("%d %d\n", k+1, tot);
	for (int i = 1; i <= tot; i++) {
		printf("%d %d %d\n", ans[i].u, ans[i].v, ans[i].w);
	}
    return 0;
}


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

int main(){
    long int n;
    cin >> n; 
    int count = 0;
    
    if(n < 357){
        cout << 0 << endl;
        return 0;
    }
    else {
        long int p;
        if(n >= 777777753){
            cout << 26484 << endl;
            return 0;
        }
        
        if(n >= 555555555){
            p = 555555555;
            count = 17409;
        }
        else {
            p = 357;
        }
        //cout << p << endl;
        for(long int i = p; i <= n; i+=2){
            //cout << i << endl;
            int num = i;
            int flag_3 = 0;
            int flag_5 = 0;
            int flag_7 = 0;
            int flag_other = 0;
            while(num > 0){
                int flag = num % 10;
                if(flag == 3){
                    flag_3++;
                }
                else if(flag == 5){
                    flag_5++;
                }
                else if(flag == 7){
                    flag_7++;
                }
                else {
                    flag_other++;
                    break;
                }
                num = num / 10;
            }
            if(flag_3 > 0 && flag_5 > 0 && flag_7 > 0 && flag_other == 0){
                    count++;
            }
        }
        
    }
    cout << count << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    var n = readLine()!!.toLong()
    var ans = ModInt(10).pow(n)-ModInt(9).pow(n)-ModInt(9).pow(n)+ModInt(8).pow(n)
    println(ans)

}

class ModInt(x: Long) {

    companion object {
        const val MOD = 1000000007L
    }

    val x = (x % MOD + MOD) % MOD

    operator fun plus(other: ModInt): ModInt {
        return ModInt(x + other.x)
    }

    operator fun minus(other: ModInt): ModInt {
        return ModInt(x - other.x)
    }

    operator fun times(other: ModInt): ModInt {
        return ModInt(x * other.x)
    }

    operator fun div(other: ModInt): ModInt {
        return this * other.inv()
    }

    fun pow(exp: Long): ModInt {
        if (exp == 0L) return ModInt(1L)
        var a = pow(exp shr 1)
        a *= a
        if (exp and 1L == 0L) return a
        return this * a
    }

    fun inv(): ModInt {
        return this.pow(MOD - 2)
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as ModInt

        if (x != other.x) return false

        return true
    }

    override fun hashCode(): Int {
        return x.hashCode()
    }

    override fun toString(): String {
        return "$x"
    }

}

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

int main(){
    ll N,cn=0,A=0,B=0,BA=0;cin>>N;
    string s[10010];
    rep(i,0,N){
        cin>>s[i];
        rep(j,0,s[i].size()-1){
            if(s[i].at(j)=='A'&&s[i].at(j+1)=='B')cn++;
        }
        if(s[i].at(0)=='B'&&s[i].at(s[i].size()-1)=='A')BA++;
        else if(s[i].at(0)=='B')B++;
        else if(s[i].at(s[i].size()-1)=='A')A++;
    }
    if(BA!=0&&B==0&&A==0)cn+=BA-1;
    else cn+=min(BA+A,BA+B);
    cout<<cn<<endl;
}







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

using ll = long long;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)

int main(){
	ll a,b,x;
	cin >> a >> b >> x;
	if(!a){
		a = 0;
	}
	else{
		a = (a - 1) / x + 1;
	}
	cout << b / x + 1 - a << endl;
	return 0; 
}

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

vector<char> op(3);

bool check(int ind, vector<int> num, int ans){
  if(ind == 3){
    if (ans == 7){
      return true;
    }else{
      return false;
    }
  }else{
    op[ind] = '+';
    if (check(ind+1, num, ans+num[ind+1])){
      return true;
    }
    op[ind] = '-';
    if (check(ind+1, num, ans-num[ind+1])){
      return true;
    }
    return false;
  }
}

int main(){
  vector<int> num(4);
  int n;
  string s;
  cin >> s;
  n = stoi(s);
  for(int i = 0; i < 4; i++){
    num[3-i] = n % 10;
    n = n / 10;
  }
  if (check(0, num, num[0])){
    for(int i = 0; i < 3; i++){
      cout << num[i] << op[i];
    }
    cout << num[3] << "=7" << endl;
  }else{
    cout << "no" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
campus = [['.' for _ in range(W+2)]]
for _ in range(H):
    campus.append(['.'] + list(input()) + ['.'])
campus.append(['.' for _ in range(W+2)])

finish = True
for i in range(1, H+1):
    for j in range(1, W+1):
        if campus[i][j] == '#':
            if campus[i-1][j] != '#' and campus[i][j+1] != '#' and campus[i+1][j] != '#' and campus[i][j-1] != '#':
                finish = False
                break
    else:
        continue
    break
if finish:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
n = int((input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sum = 0

for i in range(n):
    sum += b[i]
for j in range(n-1):
    if (a[j])+1 == a[j+1]:
        sum += c[a[j]-1]
print(sum)


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

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String str = sc.next();
        String test = str.substring(str.length() - 1, str.length());
        switch (test) {
            case "2":
            case "4":
            case "5":
            case "7":
            case "9":
                System.out.println("hon");
                break;
            case "0":
            case "1":
            case "6":
            case "8":
                System.out.println("pon");
                break;
            case "3":
                System.out.println("bon");
        }
    }
}

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;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        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() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 32484
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N / 1000; // 1000の位
  b = N / 100 - a * 10; // 100の位
  c = N / 10 - (a * 100 + b *10);  // 10の位
  d = N - (a * 1000 + b *100 + c * 10); // 1の位
  
  if ((a == b && b == c)||(b == c && b == d)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import scipy.sparse as s,numpy as n
f=n.loadtxt(open(0),skiprows=1)
g=s.csgraph.dijkstra(f)
h=n.where(g,g,1)
a=0
for i,t in enumerate(h):
  for j in range(i):
    a+=t[j]*(t[j]<t+h[j]).all()
print(int(a)*(f==g).all()or-1)

Measured memory_bytes: 20556
#include <algorithm>
#include <array>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
constexpr int INF = 100100100;

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

using namespace std;

vector<int> group(string const &S) {
  vector<int> v = {0};
  int const len = S.length();
  char kind = '1';
  int num = 0;

  int i = 0;
  while (i < len) {
    if (kind != S[i]) {
      v.push_back(num);
      kind = S[i];
      num = 1;
    } else {
      ++num;
    }
    ++i;
  }
  v.push_back(num);
  return v;
}

int main() {
  // cout << fixed << setprecision(10);
  int N, K;
  cin >> N >> K;

  string S; cin >> S;
  auto v = group(S);
  REP(i, K*3) {
    v.push_back(0);
  }
  for (int i = 1, len = v.size(); i < len; ++i) {
    v[i] += v[i-1];
  }

  int ans = 0;
  int const diff = 2 * K;
  for (int i = 1, len = v.size(); i+diff<len ; i += 2) {
    chmax(ans, v[i+diff] - v[i-1]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2548
while(True):
    w, h = map(int, input().split())
    if h == 0 and w == 0:
        break
    
    for i in range(w):
        for j in range(h):
            if i == 0 or i == w-1:
                print('#', end='')
            elif j == 0 or j == h-1:
                print('#', end='')
            else:
                print('.', end ='')
        print('')
    print('')


Measured memory_bytes: 7012
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    int n, l;
    cin >> n >> l;
    vector<string> p(n);;
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    for(auto a : p){
        cout << a;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define clock_start       clock_t begin = clock();
#define clock_end         clock_t end = clock(); double time_spent = (double)(end - begin) / CLOCKS_PER_SEC; cout << time_spent << endl;
#define PI 3.14159265358979323846264338327950288419716939937510
using namespace std;
ll n;
ll d;
vector< ll > pp[5];
int main(){
    cin >> d >> n;
    /*for(ll i = 0; i <= 2; i ++){
        ll ctr = 0;
        ll num = 1;
        while(ctr <= 100){
            if(i == 0){
                if((num % 100) != 0){
                    ctr ++;
                    pp[i].push_back(num);
                    num ++;
                }
            }
            else if(i == 1){
                if((num % 100 == 0) && ((num/100)%100 == 0) && (((num/100)/100)%100!=0)){
                    ctr ++;
                    pp[i].push_back(num);
                    num ++;
                }
            }
            else if(i == 2){
                if((num % 100 == 0) && ((num/100)%100 == 0) && (((num/100)/100)%100==0) && (((num/100)/100)/100)%100 != 0){
                    ctr ++;
                    pp[i].push_back(num);
                    num ++;
                }
            }
        }
    }*/
    //cout << pp[d][n - 1] << endl;
    if(d == 0){
        if(n < 100) cout << n << endl;
        else cout << 101 << endl;
    }
    else if(d == 1){
        if(n < 100) cout << n << "00" << endl;
        else cout << 10100 << endl;
    }
    else{
        if(n < 100) cout << n << "0000" << endl;
        else cout << 1010000 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
#define M_INF -1000000000
typedef long long int ll;

int main(){
    ll h,w;
    cin>>h>>w;
    if(h%3==0 || w%3==0){
        cout<<0<<endl;
    }else{
        ll ans=min(h,w);//縦横３等分の場合
        for(int i=1;i<h;i++){
            ll a=i*w,b,c;
            if(w%2==0){
                b=(h-i)*(w/2);
                c=b;
            }else{
                b=(h-i)*(w/2);
                c=(h-i)*(w/2+1);
            }
            ans=min(ans,abs(max(a,max(b,c))-min(a,min(b,c))));
        }
        for(int i=1;i<w;i++){
            ll a=i*h,b,c;
            if(h%2==0){
                b=(w-i)*(h/2);
                c=b;
            }else{
                b=(w-i)*(h/2);
                c=(w-i)*(h/2+1);
            }
            ans=min(ans,abs(max(a,max(b,c))-min(a,min(b,c))));
        }
        cout<<ans<<endl;
    }
    return 0;
}
    

Measured memory_bytes: 256
integer L,R
integer ans
read*,L,R
if(R-L>=2018)then
  print"(i0)",0
  stop
endif

L=mod(L,2019)
R=mod(R,2019)
if(R<L)then
  print"(i0)",0
  stop
endif

ans=2019
do i=L,R-1
  do j=L+1,R
    ans=min(ans,mod(i*j,2019))
  end do
end do

print"(i0)",ans

end

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_set>

using namespace std;

int lookup(vector<int>& subgraphs, int node){
    if(subgraphs[node]==node) return node;
    int g=lookup(subgraphs, subgraphs[node]);
    subgraphs[node]=g;
    return g;
}

void connect(vector<int>& subgraphs, int node1, int node2){
    int g1=lookup(subgraphs, node1);
    int g2=lookup(subgraphs, node2);
    if(g1==g2) return;
    subgraphs[g1]=g2;
}

int main(){
    int n, m; cin >> n >> m;
    vector<pair<int, int>> edges(m);
    for(int i=0; i<m; ++i){
        int a, b; cin >> a >> b;
        edges[i].first=a-1;
        edges[i].second=b-1;
    }

    int ans=0;
    for(int i=0; i<m; ++i){
        vector<int> subgraphs(n);
        for(int j=0; j<n; ++j) subgraphs[j]=j;
        for(int j=0; j<m; ++j){
            if(j==i) continue;
            connect(subgraphs, edges[j].first, edges[j].second);
        }
        unordered_set<int> s;
        for(int j=0; j<n; ++j){
            int g=lookup(subgraphs, j);
            s.insert(g);
        }
        ans+=s.size()!=1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define ull unsigned long long
#define pb push_back
#define rr return 0
#define fi first
#define se second
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define sz(s) s.size()
using namespace std;
//Debug template by livw
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

//ll pm(ll x,ll y){ll res = 1;while(y>0){if(y&1) res = (res*x)%mod;x= (x*x)%mod;y/=2;}return res;}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main()
{
 fastio;
 int i,count=0,max=0;
string s;
cin>>s;
for(i=0;i<3;i++)
{
  if(s[i]=='R')
  {
    count++;
  }
  else if(s[i]=='S'&&count>max)
  {
    max=count;
    count=0;
  }
}
if(count>max)
{
  max=count;
}
cout<<max;
rr;
}


Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
int main(){
  ll h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  ll ans = (h2-h1)*60 + (m2-m1);
  cout << ans-k << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr ll INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N,C;cin >> N >> C;
    vector<pair<int,pair<int,int>>> V(N);
    REP(i,N) cin >> V[i].second.first >> V[i].second.second >> V[i].first;
    sort ALL(V);
    vector<pair<int,int>> W;
    REP(i,N){
        if(i != N-1){
            int C = V[i].second.first, D = V[i].second.second;
            while(V[i].first == V[i+1].first && V[i+1].second.first == V[i].second.second){
                D = V[i+1].second.second;i++;
            }
            W.pb({C,D});
            continue;
        }
        W.pb({V[i].second.first,V[i].second.second});
    }
    int A[100100] = {},B[100100] = {};
    REP(i,W.size()){
        A[W[i].first]++;B[W[i].second]++;
    }
    int cnt = 0,maxv = 0;
    REP(i,100100){
        cnt += A[i];
        maxv = max(maxv,cnt);
        cnt -= B[i];
    }
    cout << maxv << endl;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

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

Measured memory_bytes: 256
S = input()
F = int(S[:2])
L = int(S[2:])

if (F >= 13 and L >= 13) or (F == 0 and L == 0) or (F >= 13 and L == 0) or (F == 0 and L >= 13):
    print('NA')
elif F >= 13 or F == 0:
    print('YYMM')
elif L >= 13 or L == 0:
    print('MMYY')
else:
    print('AMBIGUOUS')

Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N;
void dfs(int x,vector<int> V,int lim){
    if(x!=N)V.push_back(lim);
    if(x == 0){
        cout<<V[0];
        for(int i = 1;i < V.size();i++)cout<<" "<<V[i];
        cout<<endl;
        return;
    }
    for(int i = lim;i > 0;i--){
        if(x>=i){
            dfs(x-i,V,i);
        }
    }
}
int main(){

    vector<int> V;
    while(cin>>N,N)dfs(N,V,N);

    return 0;
}

Measured memory_bytes: 1224
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;

int main() {
	int x, n;
	cin >> x >> n;
	vector<int>p(100,0);
	for (int i = 0; i < n; i++) {
		int k;
		cin >> k;
		p[k]++;
	}
	int i = 0;
	int ans;
	while (1) {
		if (p[x - i] == 0) {
			ans = x - i;
			break;
		}
		else if (p[x + i] == 0) {
			ans = x + i;
			break;
		}
		i++;
	}
	cout << ans;

	return 0;
	
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >>N;
  long long int H[N];
  for(int i=0;i<N;i++)
    cin >>H[i];
  
  for(int i=N-1;i>0;i--){
    if(H[i]<=H[i-1])
      H[i]=0;
  }
  int count=0,ans=0;
    for(int i=0;i<N;i++){
      if(H[i]==0)
	count++;
      else if(H[i]!=0){
	if(count>ans)
	  ans=count;
	  count=0;
      }      
    }
    if(count>ans)
      ans=count;
    cout<<ans<<endl;
  return 0;
}


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



int main() {
    vector<int> antennas(5);
    rep (i, 5) cin >> antennas[i];
    int k; cin >> k;

    int pmax = *max_element(antennas.begin(), antennas.end());
    int pmin = *min_element(antennas.begin(), antennas.end());

    if (pmax - pmin > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}



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

typedef pair<int, int> P;

ll n;

int main()
{
	cin >> n;
	for (ll i = 1; i <= 3500; i++)
	{
		for (ll j = 1; j <= 3500; j++)
		{
			if (4 * i * j <= n * (i + j))
				continue;
			if ((n * i * j) % (4 * i * j - n * i - n * j) == 0)
			{
				printf("%lld %lld %lld", i, j, (n * i * j) / (4 * i * j - n * i - n * j));
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define int long long
using namespace std;


signed main(){
	int a,b,c,k,ans;
	cin>>a>>b>>c>>k;
	if(k%2)ans=b-a;
	else ans=a-b;
	if(ans>1e18)cout<<"Unfair"<<endl;
	else cout<<ans<<endl;
	return 0;
}

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

int main() {
	int a=1;
	while(1){
		int x;
		cin>>x;
		if(x==0){
			break;
		}
		else{
			cout<<"Case"<<" "<<a<<":"<<" "<<x<<"\n";
			a++;
		}
	}
}


Measured memory_bytes: 1160
import sys
n,m,x= map(int, sys.stdin.readline().rstrip("\n").split())
lines = [ [int(s) for s in line.split()] for line in sys.stdin ]

books = {}
num = 0
for a in range(2):
    for b in range(2):
        for c in range(2):
            for d in range(2):
                for e in range(2):
                    for f in range(2):
                        for g in range(2):
                            for h in range(2):
                                for i in range(2):
                                    for j in range(2):
                                        for k in range(2):
                                            for l in range(2):
                                                for o in range(2):
                                                    books[num] = [a,b,c,d,e,f,g,h,i,j,k,l]
                                                    num += 1
price = -1
skill = {}
for i in range(2**13-1):
    price_ = 0
    for j in range (m):
        skill[j] = 0
    for j in range(n):
        if books[i][j] == 1:
            price_  += lines[j][0]
            for k in range(m):
                skill[k] = skill[k] + lines[j][k+1]
        for k in range(m):
            if skill[k] < x:
                break
        else:
            if price == -1:
                price = price_
            else:
                price = min(price, price_)
print(price)

Measured memory_bytes: 71496
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

void solve()
{
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    int a, b;
    cin >> a >> b;
    int ret = b;
    if(6 <= a && a <= 12) ret /= 2;
    if(a <= 5) ret = 0;
    cout << ret << endl;
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 256