akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r;
    cin >> r;
    cout << r * r << endl;
}

Measured memory_bytes: 256
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
  S = input()
  if S == "AC":
    AC += 1
  elif S == "WA":
    WA += 1
  elif S == "TLE":
    TLE += 1
  elif S == "RE":
    RE += 1

print("AC x",AC)
print("WA x",WA)
print("TLE x",TLE)
print("RE x",RE)

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll k, n;
    cin >> k >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    a.push_back(a[0]+k); //ちょうど1周期後
    ll l=0; 
    rep(i,n) l = max(l, a[i+1]-a[i]); //最長の区間を求める
    ll ans = k-l; //求める長さ　＝　周期 - 最長区間
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 6400
#include<iostream>
using namespace std;
int main(void){
  	int A, B;
  	cin >> A >> B;
  	if ( A >= 13 ) cout << B << endl;
  	else if ( 6 <= A ) cout << B / 2 << endl;
  	else cout << "0" << endl;
	return 0;
}


Measured memory_bytes: 256
include Math
a, b, g = gets.split(" ").map(&:to_i)

printf("%.10f\n", a*b*sin(g*PI/180)/2)
printf("%.10f\n", a + b + (a*a + b*b - 2*a*b*cos(g*PI/180))**0.5)
printf("%.10f\n", b*sin(g*PI/180))



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

const int INF = 1e9;

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

  set<int> a;
  set<int> b;
  for (int i=0; i<m; i++) {
    int ai, bi;
    cin>>ai>>bi;
    if (ai == 1) {
      a.insert(bi);
    }
    if (bi == n) {
      b.insert(ai);
    }
  }
  for (int ai: a) {
    if (b.find(ai) != b.end()) {
      cout<<"POSSIBLE"<<endl;
      return 0;
    }
  }

  cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		
		if (str.matches("(hi)+")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 20948
#include <iostream>

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

using namespace std;

int main () {

    int input = 0;
    cin >> input;

    long long output = 0;
    rep(i, (input + 1)) {
        if ( i % 3 == 0 || i % 5 == 0) {
            continue;
        }
        output += i;
    }
	cout << output << endl;
    return 0;
}


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

int main() {
 int N, M;
 cin >> N >> M;
 vector<int> homework(M);
 for(int i = 0; i < M; i++){
   cin >> homework.at(i);
 }
 long long sum = 0;
 for(int i = 0; i < M; i++){
   sum += homework.at(i);
 }
  if(sum <= N){
    cout << N-sum << endl;
    return 0;
  }
  else cout << -1 << endl;
}

Measured memory_bytes: 3668
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

def aaa(i, j):
    cnt = 0
    for x in [-1, 0, 1]:
        for y in [-1, 0, 1]:
            if (not 0 <= i + y < H) or (not 0 <= j + x < W):
                continue
            if S[i + y][j + x] == '#':
                cnt += 1    
    return str(cnt)

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        S[i][j] = aaa(i, j)
for s in S:
    print("".join(s))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define endl "\n"
#define int long long
#define F first
#define S second
#define B begin
#define E end
#define RB rbegin
#define RE rend
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const int INF = 1e9 + 1;
const double EPS = 1e-10;
const ll P = 1e9 + 7;
const int Q = 47;
 
using namespace std;
 
void hello()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
 
void show(vector<int>& arr)
{
    for (auto i : arr)
        cout << i << " ";
    cout << endl;
}
void show(vector<vector<int>>& arr)
{
    for (auto i : arr)
        show(i);
    cout << endl;
}


signed main()
{
    hello();
    
    int x;
    cin >> x;
    if (x >= 30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

using namespace std;

int main(void) {
	int D[1001][1001] = {};
	string s1, s2;
	cin >> s1 >> s2;
	for (int i = 0; i <= s1.length(); i++)
		D[i][0] = i;
	for (int i = 0; i <= s2.length(); i++)
		D[0][i] = i;
	for (int i = 1; i <= s1.length(); i++) {
		for (int j = 1; j <= s2.length(); j++) {
				D[i][j] = min(D[i - 1][j - 1] + ((s1.at(i - 1) != s2.at(j - 1)) ? 1 : 0),
					min(D[i - 1][j] + 1, D[i][j - 1] + 1));
		}
	}
	cout << D[s1.length()][s2.length()] << endl;
}

Measured memory_bytes: 5108
s = str(input())

cnt = 0
max_cnt = 0
acgt = ["A", "C", "G", "T"]

for e in s:
    if(acgt.count(e) == 1):
        cnt += 1
    else:
        if(cnt >= max_cnt):
            max_cnt = cnt
        cnt = 0

if(cnt >= max_cnt):
    max_cnt = cnt
print(max_cnt)


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

namespace ABC062B
{
    class Program
    {
        static void Main(string[] args)
        {
            int H, W;
            string[] vals = Console.ReadLine().Split(' ');
            H = int.Parse(vals[0]);
            W = int.Parse(vals[1]);
            string[] lines = new string[H];
            for(int i=0; i < H; i++)
            {
                lines[i] = Console.ReadLine();
            }

            for(int i=0; i < W + 2; i++)
            {
                Console.Write("#");
            }
            Console.WriteLine();

            for(int i=0; i < H; i++)
            {
                Console.Write("#");
                Console.Write(lines[i]);
                Console.WriteLine("#");
            }

            for (int i = 0; i < W + 2; i++)
            {
                Console.Write("#");
            }
            Console.WriteLine();

        }
    }
}


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

const int E = 100000;
int par[E], rank1[E];
struct Edge { int u, v, cost; };

bool comp(const Edge& e1, const Edge& e2){
	return e1.cost < e2.cost;
}

Edge edge[E];

void init(int n)
{
	for(int i = 0; i < n; ++i){
		par[i] = i;
		rank1[i] = 0;
	}
}

int find(int x)
{
	if(x == par[x])
		return x;
	else
		return par[x] = find(par[x]);
}

void unite(int x, int y)
{
	x = find(x);
	y = find(y);
	if(x == y) return;
	
	if(rank1[x] > rank1[y])
		par[y] = x;
	else {
		par[x] = y;
		if(rank1[x] == rank1[y])
			rank1[x] ++;
	}
}

bool same(int x, int y)
{
	return find(x) == find(y);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int v, e;
	cin >> v >> e;
	init(v);
	
	int s, t, w;
	for(int i = 0; i < e; ++i){
		cin >> s >> t >> w;
		edge[i] = Edge{ s, t, w };
	}
	
	sort(edge, edge + e, comp);
	
	int ans = 0;
	for(int i = 0; i < e; ++i){
		Edge e1 = edge[i];
		if(!same(e1.u, e1.v)){
			unite(e1.u, e1.v);
			ans += e1.cost;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 2468
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

N=int(input())
A=[0]*1000
total=1
for i in range(1,N+1):
    for j in range(len(factorize(i))):
        A[factorize(i)[j]]+=1

for i in range(2,1000):
    if A[i]>=1:
        total*=(A[i]+1)

print(total%1000000007)


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

int table[30][100005];
int used[30][100005];
int main(){
  int n, c;
  cin >> n >> c;
  for(int i = 0; i < n; i++){
    int s, t, cc;
    cin >> s >> t >> cc;
    s--; cc--;
    table[cc][s]++;
    table[cc][t]--;
  }
  for(int i = 0; i < c; i++){
    for(int j = 1; j < 100005; j++) table[i][j] += table[i][j-1];
  }
  for(int i = 0; i < c; i++){
    for(int j = 0; j < 100005; j++) if(table[i][j]) used[i][j]++;
  }
  int sum = 0;
  for(int i = 0; i < 100005; i++){
    int tmp = 0;
    for(int j = 0; j < c; j++) tmp += used[j][i];
    sum = max(sum, tmp);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

int main(){
  int n,m;
  cin>>n>>m;
  vector<string> vec(m);
  rep(i,m) cin>>vec[i];

  int e = 0;
  int w = 0;
  rep(i,m)rep(j,n) if(vec[i][j]=='W') w++;

  int best = 0;
  int bestd = w+e;
  rep(i,n){
    rep(j,m){
      if(vec[j][i]=='E') e++;
      else w--;
    }
    int nd = w+e;
    if(nd < bestd){
      bestd = nd;
      best = i+1;
    }
  }

  cout << best << " " << best+1 << endl;

  return 0;
}

Measured memory_bytes: 4500
h,w = map(int,input().split())
s = [[i for i in input()] for j in range(h)]


"""
s_idx = [-1,-1]
g_idx = [-1,-1]

for i in range(h):
    for j in range(w):
        if s[i][j] == 'S':
            s_idx[0] = i
            s_idx[1] = j
        if s[i][j] == 'G':
            g_idx[0] = i
            g_idx[1] = j
"""

tate = [0,0,1,-1]
yoko = [-1,1,0,0]

mat=[[10**18 for i in range(w*h)] for j in range(w*h)]

for i in range(w*h):
    mat[i][i] = 0

for i in range(w*h):
    for j in range(4):
        next_idx = i + w*tate[j] + yoko[j]
        if next_idx < 0 or next_idx >= w*h:
            continue
        if i % w == 0:
            if j == 0:
                continue
        if i % w == w - 1:
            if j == 1:
                continue
        if s[next_idx//w][next_idx%w] == '#':
            mat[i][next_idx] = 10**18
        else:
            mat[i][next_idx] = 1

for i in range(w*h):
    #print(i,i,i,i,i,i,i,i,i)
    for x in range(w*h):
        for y in range(w*h):
            """
            if x == s_idx[0]*w+s_idx[1] and y == g_idx[0]*w+g_idx[1]:
                print(mat[x][y],mat[x][i] , mat[i][y],i)
            """
            mat[x][y] = min(mat[x][y], mat[x][i] + mat[i][y])
    
ans = 0
tmp = []

for i in range(w*h):
    for j in range(w*h):
        """
        下記4行がないからWA生やした
        """
        if s[i//w][i%w] == '#':
            continue
        if s[j//w][j%w] == '#':
            continue
        ans = max(ans,mat[i][j])
        #if ans > mat[i][j]:
        #    tmp.append(mat[i][j])
            
print(ans)



Measured memory_bytes: 44380
#include <bits/stdc++.h>
#define ll long long int
#define mx 1007
double arr[mx];

#define pi acos(-1)
using namespace std;


int main()
{
    ll t,item,temp,a,m,x,y,z;
    ll x1,x2,y1,y2;

    vector<ll>v;
    string s1,s2,s3;
    stack<string>ba;
    stack<string>fo;
    vector<ll>v1;
    vector<ll>v2;
    map<ll,ll>mp1;
    map<ll,ll>mp2;



    ll r,g,b;
    ll n;
    char c;
    cin>>c;
    if(c>='A' && c<='Z')
        cout<<"A"<<endl;
    else
        cout<<"a"<<endl;



    return 0;
}


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

int main(){
  int flag[30]={};
  char s[110];
  scanf("%s",s);
  for(int i=0;i<strlen(s);i++)
    flag[s[i]-'a']++;
  for(int i=0;i<30;i++){
    if(flag[i]%2==1){
      printf("No\n");
      break;
    }
    else if(i==29)
      printf("Yes\n");
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    vector <vector <vector<double>>> dp(n+3, vector<vector<double>>(n+3, vector<double>(n+3, 0)));
    for(int three=1; three<n+2; three++){
        for(int two=1; two<n+2; two++){
            for(int one=1; one<n+2; one++){
                ll tot = one + two + three - 3;
                if (tot > n){
                    continue;
                }
                if (tot == 0){
                    continue;
                }
                double add = 0;
                add += dp[one-1][two][three] * (one-1);
                add += dp[one+1][two-1][three] * (two-1);
                add += dp[one][two+1][three-1] * (three-1);
                add += n;
                add /= tot;
                dp[one][two][three] = add;
            }
        }
    }
    ll one = 0; ll two = 0; ll three = 0;
    REP(i, n){
        ll a; cin >> a;
        one += a == 1;
        two += a == 2;
        three += a == 3;
    }
    printf("%0.12f", dp[one+1][two+1][three+1]);
    return 0;
}

Measured memory_bytes: 221184
import sys
sys.setrecursionlimit(10**6)

N = int(input())
h = list(map(int,input().split()))

memo = [-1]*N

def calc_cost(i):
  if memo[i] != -1:
    return memo[i]
  
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[0]-h[1])
  
  a = calc_cost(i-1)+abs(h[i]-h[i-1])
  b = calc_cost(i-2)+abs(h[i]-h[i-2])
  
  memo[i] = min(a,b)
  return(memo[i])

print(calc_cost(N-1))

Measured memory_bytes: 94100
#include <iostream>
#include <vector>
#include <map>
#include <string>

int main()
{
    int64_t D, T, S;
    std::cin >> D >> T >> S;

    if (T * S >= D) {
        std::cout << "Yes" << std::endl;
    }
    else {
        std::cout << "No" << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

int N;
string s;

vector<int> solve(int z, int o){
    vector<int> rec(N+20, -1);
    rec[0] = z;
    rec[1] = o;
    if(rec[0] == 0){
        if(s[0] == 'o')rec[N+1] = rec[1];
        else rec[N+1] = 1 - rec[1];
    }
    else {
        if(s[0] == 'o')rec[N+1] = 1 - rec[1];
        else rec[N+1] = rec[1];
    }

    REP(i, 1, N-1){
        if(rec[i] == 0){
            if(s[i] == 'o')rec[i+1] = rec[i-1];
            else rec[i+1] = 1 - rec[i-1];
        }
        else {
            if(s[i] == 'o')rec[i+1] = 1 - rec[i-1];
            else rec[i+1] = rec[i-1];
        }
    }
    vector<int> FA(1, -1);
    if(rec[N-1] == rec[N+1] && rec[0] == rec[N])return rec;
    else return FA;
}

int main(){
    cin >> N >> s;
    rep(i, 2){
        rep(j, 2){
            vector<int> res(N+1, 0);
            res = solve(i, j);
            if(res[0] == -1)continue;
            else {
                rep(k, N){
                    if(res[k] == 0)cout << 'S';
                    else cout << 'W';
                }
                cout << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}

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

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

    vector<string> S(H);
    vector<vector<bool>> isVisited(H, vector<bool>(W, false));

    for (int i = 0; i < H; i++)
    {
        cin >> S[i];
    }
    long long sum = 0;

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (isVisited[i][j])
                continue;
            queue<pair<int, int>> next;
            next.push(make_pair(i, j));

            long long B = 0;
            long long WH = 0;

            while (!next.empty())
            {
                pair<int, int> cur = next.front();
                next.pop();

                if (isVisited[cur.first][cur.second])
                    continue;

                isVisited[cur.first][cur.second] = true;
                //cout << cur.first << " " << cur.second << endl;

                if (S[cur.first][cur.second] == '#')
                {
                    B++;

                    if (0 <= cur.first - 1 && S[cur.first - 1][cur.second] == '.')
                    {
                        next.push(make_pair(cur.first - 1, cur.second));
                    }

                    if (cur.first + 1 < H && S[cur.first + 1][cur.second] == '.')
                    {
                        next.push(make_pair(cur.first + 1, cur.second));
                    }

                    if (0 <= cur.second - 1 && S[cur.first][cur.second - 1] == '.')
                    {
                        next.push(make_pair(cur.first, cur.second - 1));
                    }

                    if (cur.second + 1 < W && S[cur.first][cur.second + 1] == '.')
                    {
                        next.push(make_pair(cur.first, cur.second + 1));
                    }
                }
                else if (S[cur.first][cur.second] == '.')
                {
                    WH++;

                    if (0 <= cur.first - 1 && S[cur.first - 1][cur.second] == '#')
                    {
                        next.push(make_pair(cur.first - 1, cur.second));
                    }

                    if (cur.first + 1 < H && S[cur.first + 1][cur.second] == '#')
                    {
                        next.push(make_pair(cur.first + 1, cur.second));
                    }

                    if (0 <= cur.second - 1 && S[cur.first][cur.second - 1] == '#')
                    {
                        next.push(make_pair(cur.first, cur.second - 1));
                    }

                    if (cur.second + 1 < W && S[cur.first][cur.second + 1] == '#')
                    {
                        next.push(make_pair(cur.first, cur.second + 1));
                    }
                }
            }

            sum += B * WH;
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 512
S=input()
N=len(S)
goukei=0
for i in range(2 **(N-1)):
    T=[]
    T.append(S[0])
    for j in range(N-1):
        if ((i >> j) & 1):
            #print(i,j)のjbitがONの意味
            #print(i,j)
            T.append("+")
            T.append(S[j+1])
        else:
            T.append(S[j+1])
    
    #T.append(S[N-1])
    #print(T)
    tmp=[]
    for m in T:
        if m!="+":
            tmp.append(m)
        else:
            Z=[str(a) for a in tmp]
            Z="".join(Z)
            goukei+=int(Z)
            tmp=[]
    Z=[str(a) for a in tmp]
    Z="".join(Z)
    goukei+=int(Z)
    
print(goukei)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;

    int n = S.length();
    vector<char> M(n);

    for (int i = 0; i < n; i++){
        M.at(i) = S[i];
    }

    sort(M.begin(), M.end());
    M.erase(unique(M.begin(), M.end()), M.end());
    int m = M.size();

    string L = "abcdefghijklmnopqrstuvwxyz";
    int count = 0;

    for (int i = 0; i < 26; i++){
        if(i <= m -1 && M.at(i) != L[i]){
            cout << L[i] << endl;
            break;
        }
        else if (m - 1 < i){
            cout << L[i] << endl;
            break;
        }
        else {
            count++;
        }
    }

    if(count == 26) {
        cout << "None" << endl;
    }
}

Measured memory_bytes: 512
import scala.io.StdIn

/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {
    val in = StdIn.readLine().split(" ").map(s => s.toInt).toSeq.sorted
    println(in(0) + " " + in(1) + " " + in(2))
  }
}

Measured memory_bytes: 43724
#ifndef VS
#include<bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

const string ret[] = { "Takahashi\n","Aoki\n" };
int main() {
	int N;
	while (cin >> N) {
		int g = 0;
		for (int i : range(N)) {
			int a, k;
			cin >> a >> k;
			while (a%k&&a>=k) {
				// a = x*k +y
				int x = a / k;
				int y = a - x*k;
				// g(a) = g(x*k + y) = g(x*k + z);
				int z = y % (x + 1);

				a = x*k + z;
				if (z!=0) {
					a -= x+1;
				}
			}
			if (a >= k)g ^= a / k;
			//cout << a / k << endl;
		}
		cout << ret[g == 0];
	}
	/*
	0 1 2 3 4 5 6 7 8 9,0 1 2 3 4 5 6 7 8 9,0 1 2 3 4 5 6 7 8
	0 0 0,0 1 0 2 1 0,3 2 1,4 0 3,5 2 1,6 4 0,7 3 5,8 2 1,9 6
	0 0 0 0 1 0 1 0 2 1 0 2 3 1 0 2 4
	0 0,1 0,2 1 3 0 4 2 5 1 6 3 7 0 8 4 9 2
	*/
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("trapv")
#define I inline void 
#define S struct 
#define vi vector<int> 

using namespace std ; 
using ll = long long ; 
using ld = long double ; 

const int N = 1e6 + 7 , mod = 1e9 + 7 ; 
int n ; 

// How interesting!
int fat[N] , sz[N] ; 

int fin(int x){
	if(fat[x]!=x){return fat[x] = fin(fat[x]);}  
	return x ; 
}

I link(int u , int v){
	u = fin(u) ; 
	v = fin(v) ; 
	if(u !=v){
		sz[v]+= sz[u]  ; 
		fat[u] = v; 
		sz[u] = 0 ; 
	}
}

int main(){
	ios_base::sync_with_stdio(0) ; 
	cin.tie(0) ;
	//freopen("in.in" , "r" , stdin) ; 
	int m ;
	cin >> n >> m; 

	for(int i = 0 ; i< N ;i++){
		sz[i] = 1 ; 
		fat[i] = i ; 
	}

	for(int i = 0 ; i< m ;i++){
		int u , v; 
		cin >> u >> v ; 
		link(u , v) ; 
	}
	int ans = 0 ; 
	for(int i = 1 ; i<=n;i++){
		ans = max(ans , sz[i] ) ; 
	}
	cout << ans ; 
	return 0 ; 
}


Measured memory_bytes: 11456
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <sstream>
#include <string>

using namespace std;

void print_map(const map<int, int>& m) {
    for (map<int, int>::const_iterator it = m.begin(); it != m.end(); it++)
    {
        std::cout << it->first << "=>" << it->second << " ";
    }
    std::cout << "\n";
}

int main()
{
    int n;
    std::cin >> n;

    map<int, int> M;
    for (int i = 1; i <= n; ++i)
    {
        std::cin >> M[i];
    }

    // print_map(M);
    int ans = 0;
    for (int i = 1; i <= n; ++i)
    {
        // std::cout << i << "=>" << M[i] << " ";
        // std::cout << M.find(M[i])->first << "=>" << M.find(M[i])->second << "\n";
        // std::cout << M.find(i)->second << "\n";
        if (M.find(M[i]) != M.end() && M.find(M[i])->second == i)
        {
            ans++;
        }
    }

    // if(M.find("SRM") != M.end()) {
    //     M.erase(M.find("SRM")); // or even M.erase("SRM")
    // }

    std::cout << ans / 2 << "\n";

    return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>
int main() {
	int k, x;
	scanf("%d%d", &k, &x);
	for (int i = -k+1; i <= k-1; i++) {
		int c;
		c = x + i;
		if (c >= -1000000 && c <= 1000000) {
			printf("%d ",c);
		}
	}
}


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

int main()
{
  int64_t N, x, y, h, ch;
  cin >> N;
  vector<tuple<int64_t, int64_t, int64_t>> vt;
  for (int i = 0; i < N; i++)
  {
    cin >> x >> y >> h;
    vt.push_back({h, x, y});
  }
  sort(vt.begin(), vt.end());
  reverse(vt.begin(), vt.end());
  for (int cx = 0; cx <= 100; cx++)
  {
    for (int cy = 0; cy <= 100; cy++)
    {
      int64_t fx, fy, fh, H, xi, yi, hi;
      tie(fh, fx, fy) = vt.at(0);
      H = fh + abs(fx - cx) + abs(fy - cy);
      bool ok = true;
      for (int i = 0; i < N; i++)
      {
        tie(hi, xi, yi) = vt.at(i);
        if (hi != max(H - abs(xi - cx) - abs(yi - cy), (int64_t)0))
          ok = false;
      }
      if (ok)
      {
        cout << cx << ' ' << cy << ' ' << H << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, ans=0;
  for(int i=0; i<3; i++){
    cin >> a;
    ans+=a;
  }
  if(ans>=22){
    cout << "bust"<< endl;
  }
  else{
    cout << "win" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<map>
using namespace std;
int n,k,l;
int fg[200000],ft[200000];
map<pair<int,int>,int> s;
int findg(int x)
{
	if(fg[x]!=x) fg[x]=findg(fg[x]);
	return fg[x];
}
void ug(int r1,int r2)
{
	fg[r2]=r1;
}
int findt(int x)
{
	if(ft[x]!=x) ft[x]=findt(ft[x]);
	return ft[x];
}
void ut(int r1,int r2)
{
	ft[r2]=r1;
}
int main()
{
	int r1,r2;
	scanf("%d%d%d",&n,&k,&l);
	for(int i=1;i<=n;i++) fg[i]=ft[i]=i;
	for(int i=1;i<=k;i++)
	{
		scanf("%d%d",&r1,&r2);
		r1=findg(r1);
		r2=findg(r2);
		if(r1!=r2) ug(r1,r2);
	}
	for(int i=1;i<=l;i++)
	{
		scanf("%d%d",&r1,&r2);
		r1=findt(r1);
		r2=findt(r2);
		if(r1!=r2) ut(r1,r2);
	}
	for(int i=1;i<=n;i++)
	{
		findg(i);
		findt(i);
	}
	//首先把问题数据用并查集处理为一个个联通块，
	//要 求既通过公路连通又通过铁路连通的城市数 就转化为了 求各fg与ft的交集元素数 
	//所以只需用map统计每个交集中点的数量即可
	for(int i=1;i<=n;i++)
	{
		s[{fg[i],ft[i]}]++;
		//如果两个点之间既能走公路到达，又能走铁路到达，他们肯定属于同一个交集
	}
	for(int i=1;i<=n;i++)
	{
		printf("%d ",s[{fg[i],ft[i]}]);
	}
	return 0;
}

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

template<typename T1,typename T2> void chmin(T1 &a,T2 b){if(a>b) a=b;};
template<typename T1,typename T2> void chmax(T1 &a,T2 b){if(a<b) a=b;};


Int n;
Int a[55][55];
signed main(){
  while(cin>>n,n){
    for(Int i=0;i<n;i++)
      for(Int j=0;j<n;j++)
	cin>>a[i][j];

    vector<vector<Int> > G(n+10000);
    Int x=0,y=0;
    for(Int i=0;i<n;i++)
      for(Int j=0;j<n;j++)
	if(a[x][y]<a[i][j]) x=i,y=j;

    auto add_edge=[&](Int x,Int y){
      G[x].emplace_back(y);
      G[y].emplace_back(x);
    };
    
    Int m=n;
    {
      Int lst=x;
      for(Int k=0;k+1<a[x][y];k++){
	add_edge(lst,m);
	lst=m++;
      }
      add_edge(lst,y);
    };
    vector<Int> dist,dp;
    auto bfs=[&](Int x){
      dp.assign(m,-1);
      queue<Int> q;
      dp[x]=0;
      q.emplace(x);
      while(!q.empty()){
	Int v=q.front();q.pop();
	for(Int u:G[v]){
	  if(~dp[u]) continue;
	  dp[u]=dp[v]+1;
	  q.emplace(u);
	}
      }
    };

    vector<Int> fin({x,y});
    for(Int t=0;t<n;t++){
      if(t==x||t==y) continue;
      bfs(x);
      dist=dp;
      for(Int z:fin){
	bfs(z);
	for(Int i=0;i<m;i++){
	  if(dist[i]<0) continue;
	  if(a[t][x]-dist[i]!=a[t][z]-dp[i]) dist[i]=-2;
	}
      }

      Int lst=-1;
      for(Int i=0;i<m;i++) if(dist[i]>=0) lst=i;
      Int di=a[t][x]-dist[lst];
      for(Int k=0;k+1<di;k++){
	add_edge(lst,m);
	lst=m++;
      }
      add_edge(lst,t);
      fin.emplace_back(t);
    }
    vector<Int> ans;
    for(Int i=n;i<m;i++)
      ans.emplace_back(G[i].size());
    sort(ans.begin(),ans.end());
    for(Int i=0;i<(Int)ans.size();i++){
      if(i) cout<<" ";
      cout<<ans[i];
    }
    cout<<endl;
  }
  return 0;
}



Measured memory_bytes: 3356
S = input()
W = 0

for i in S:
    if i == "W":
        W += 1

Bl = []

for i in range(W):
    if S[i] == "B":
        Bl.append(i)

Wl = []

for i in range(W, len(S)):
    if S[i] == "W":
        Wl.append(i)

N = len(Bl)
ans = 0

for i in range(N):
    ans += Wl[i] - Bl[i]

print(ans)

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

vector <bool> eratosthenes(int n) {
	vector <bool> prime(n + 1, true);
	prime = vector <bool> (n + 1, true);
	if(n >= 0) prime[0] = false;
	if(n >= 1) prime[1] = false;
	for(int i = 2; i * i <= n; i++)
		if(prime[i])
			for(int j = i * 2; j < n; j += i)
				prime[j] = false;
	return prime;
}

int main() {
	int n;
	cin >> n;
	vector <bool> p = eratosthenes(60000);
	for (int i = 0, cnt = 0; cnt < n; i++) {
		if (!p[i] || i % 5 != 1) continue;
		cout << i << " \n"[cnt == n - 1];
		cnt++;
	}
	return 0;
}

Measured memory_bytes: 256
A, B, Q = map(int, input().split())

'''計算方法
初期位置xから東西に一番近い神社をSa・Sb,寺をTa・Tbとする。
すると、これら4地点での組み合わせ8種類を全て試して、最小値を出せば良い。
（計算の都合上、神社・寺に東西のとても遠い地点Xa・Xbを用意しておく。）
'''

# 寺・神社の位置
INF = 10 ** 18

s = [-INF] + [int(input()) for i in range(A)] + [INF] # 神社の位置
t = [-INF] + [int(input()) for i in range(B)] + [INF]  # 寺の位置


# 1.初期位置xから、Sa・Sb・Ta・Tbを求める。
import bisect

for x in range(Q):
  output = INF
  X = int(input())
  s_b,t_b = bisect.bisect_right(s, X), bisect.bisect_right(t, X)
  
  for S in [s[s_b - 1], s[s_b]]: # 初期位置から一番近い神社二箇所    
    for T in [t[t_b - 1], t[t_b]]:# 初期位置から一番近い寺二箇所
      d1 = abs(S-X) + abs(T-S)
      d2 = abs(T-X) + abs(S-T)
      output = min(output, d1, d2)
  
  print(output)

Measured memory_bytes: 12896
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int j = 0; j<N; j++){
    cin >> A.at(j);
  }
  sort(A.begin(),A.end());
  int ans = A.at(N-1)-A.at(0);
  cout << ans << endl;
}

    

Measured memory_bytes: 256
import java.util.*; 

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

    
 	if(a>=13){
    		System.out.println(b);
    	}else if(a<=5){
     		System.out.println(0);
   	 }else{

    	System.out.println(b/2);
    }
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int count = 0;
    int check = 0;
    for(int i = 0 ; i < s.size(); i++){
        if(s[i] == 'C'){
            break;
        }
        check++;
    }
    for(int i = check + 1 ; i < s.size(); i++){
        if(s[i] == 'F'){
            count = 1;
            printf("Yes\n");
            break;
        }
    }
    if (count == 0){
        printf("No\n");
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;

int main(){
    while(true){
        ll n,m,k;
        cin >> n >> m >> k;
        if(n == 0) break;
        vector<double> kak(n*m+1);
        kak[0] = 1;
        for(int i=0;i<n;i++){
            vector<double> next(n*m+1);
            for(int j=1;j<=m;j++){
                for(int l=0;l+j<n*m+1;l++){
                    next[l+j] += kak[l]/m;
                }
            }
            kak = next;
        }
        double ret = 0;
        for(int i=0;i<n*m+1;i++){
            ret += max(i-k,1ll)*kak[i];
        }
        cout << fixed << setprecision(8);
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 1436
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 998244353;
const int SIZE = 1e6+10;
const double EPS=1e-12;
const double PI=acos(-1);
struct Point{
    LL x,y;
    Point(LL _x=0,LL _y=0){x=_x;y=_y;}
    Point operator-(const Point& b){return Point(x-b.x,y-b.y);}
    Point operator+(const Point& b){return Point(x+b.x,y+b.y);}
    Point operator*(const LL v){return Point(x*v,y*v);}
    LL operator*(const Point& b){return x*b.y-y*b.x;}
    LL operator^(const Point& b){return x*b.x+y*b.y;}
    bool operator<(const Point& b)const{
        return x<b.x||(x==b.x&&y<b.y);
    }
    double angle(){return atan2(y,x);}
    double dis(){return sqrt(x*x+y*y);}
    void scan(){cin>>x>>y;}
    void print(){cout<<x<<" "<<y<<endl;}
}p[200];
map<pair<PII,int>,int>ppp;
int my_gcd(int x,int y){
    x=abs(x);y=abs(y);
    if(!x||!y)return x+y;
    return __gcd(x,y);
}
void ADD(LL& x,LL v){
    x=(x+v)%MOD;
    if(x<0)x+=MOD;
}
LL two[210];
int main(){
    two[0]=1;
    REPP(i,1,210){
        two[i]=two[i-1]*2%MOD;
    }
    DRI(n);
    REP(i,n){
        p[i].scan();
    }
    REP(i,n)REP(j,i){
        Point d=p[i]-p[j];
        int gg=my_gcd(d.x,d.y);
        if(d.x<0||(!d.x&&d.y<0)){
            d=Point(-d.x,-d.y);
        }
        d.x/=gg;
        d.y/=gg;
        ppp[MP(MP(d.x,d.y),d.y*p[i].x-d.x*p[i].y)]++;
    }
    LL an=two[n];
    ADD(an,-1-n);
    for(auto it=ppp.begin();it!=ppp.end();it++){
        int v=it->S;
        int num=2;
        while(num*(num+1)/2<=v)num++;
        ADD(an,-two[num]+num+1);
    }
    return 0*printf("%lld\n",an);
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++)cin>>h.at(i);
    int cnt=0;
    int tot=0;
    for(int i=1;i<n;i++){
        if(h.at(i-1)>=h.at(i))cnt++;
        else{
            tot=max(tot,cnt);
            cnt=0;
        }
    }
    tot=max(tot,cnt);
    cout<<tot<<endl;
    return 0;
}


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

int main() {
    int N; cin >> N;
    vector<ll> A(N);
    rep(i, N){
        cin >> A[i];
    }

    ll now = 0;
    ll ans = 0;
    rep(i, N){
        if(A[i] < now){
            ans += now - A[i];
        } else {
            now = A[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >>S;
    int t=S.size();
    string A(t,'0');
    string B(t,'0');
    if(t%2==0){
        for(int i=0;i<t/2;i++){
            A[2*i]='1';
            A[2*i+1]='0';
            B[2*i]='0';
            B[2*i+1]='1';
        }
    }
    if(t%2==1){
        for(int i=0;i<t/2;i++){
            A[2*i]='1';
            A[2*i+1]='0';
            B[2*i]='0';
            B[2*i+1]='1';
        }
        A[t-1]='1';
        B[t-1]='0';
    }
    int a=0,b=0;
    for(int i=0;i<t;i++){
        if(S[i]!=A[i]){
            a++;
        }
        if(S[i]!=B[i]){
            b++;
        }
    }
    cout <<min(a,b)<<endl;
}


Measured memory_bytes: 512
N = int(input())
num = [0]*N
A = list(map(int,input().split()))

for a in A:
  num[a-1] += 1

norm = []
ans = []

for n in num:
  norm.append(n*(n-1)//2)
nsum = sum(norm)
for i in range(N):
  if num[i]==0:
    ans.append(-1)
  else:
    ans.append(nsum-norm[i]+(norm[i]*(num[i]-2))//num[i])
for a in A:
  print(ans[a-1])


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

int main(){
  int a[1000001];
  cin >> a[1];
  int i=1;
  int ok=0;
  int ans;
  while(ok==0){
	if(a[i]%2==0){
    	a[i+1] = a[i]/2;
    }else{
		a[i+1] = 3*a[i]+1;
    }
    for(int j=1;j<=i;j++){
      if(a[i+1]==a[j]){
        ans = i+1;
      	ok=1;
      }
    }
    i++;  
  }
  
  cout << ans << endl;
  
	return 0;
}

Measured memory_bytes: 256
from collections import deque
t = 0
n, q = list(map(int,input().split()))
name = deque([])
time = deque([])
for i in range(n):
  v = input().split()
  name.append(v[0])
  time.append(int(v[1]))
while name:
  temp_t = time.popleft()
  temp_name = name.popleft()
  if temp_t > q:
    t += q
    time.append(temp_t -q)
    name.append(temp_name)
  else:
    t += temp_t
    print(temp_name,t)


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

#define all(v) begin(v), end(v)
#define endl '\n';
#define int long long
#define pii pair<int, int>

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);

    char c; cin >> c;
    if (c >= 97) {
        cout << 'a' << endl;
    }
    else {
        cout << 'A' << endl;
    }

}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
 
using namespace std;
 
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	string s; cin >> s;
	char ch;
	int pos, ans = 1000, cans = 1000, n = s.size();
	for(int i = 0;i < 26;i++)
	{
		ch = (char)('a' + i);
		pos = -1;
		cans = 0;
		for(int j = 0;j < s.size();j++)
			if(s[j] == ch)
			{
				cans = max(cans, j - pos - 1);
				pos = j;
			}
		cans = max(cans, n - 1 - pos);
		ans = min(ans, cans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
<?php

$N = trim(fgets(STDIN));
$D = trim(fgets(STDIN));
$D = str_split($D);

$ans = 1;
$x = $D[0];
for ($i=1; $i < count($D); $i++) { 
    if ($D[$i] == $x) {
        continue;
    }
    $ans++;
    $x = $D[$i];
}
echo $ans;

Measured memory_bytes: 21388
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <sstream>

using namespace std;
typedef long long ll;


int main(){
    int n, m;
    int ans[10][11] = {0};
    int remain[10] = {0};
    int a = 0;
    int P[10];

    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> ans[i][0];
        for (int j = 1; j <= ans[i][0]; j++) {
            cin >> ans[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> P[i];
    }

    
    for (int bit = 0; bit < (1<<n); bit++) {
        int tuiteru;
        for (int i = 0; i < m; i++) {
            tuiteru = 0;
            int p = P[i];
            int cnt = 0;
            int k = ans[i][0];
            for (int j = 1; j <= k; j++) {
                int s = ans[i][j];
                if (bit & (1<<(s-1))) {
                    cnt++;
                }
            }
            if (cnt % 2 != p) {
                break;
            } else {
                tuiteru = 1;
            }
        }
        if (tuiteru) {
            a++;
        }
    }
    cout << a;
    return 0;
}

Measured memory_bytes: 888
program main
      implicit none
      integer :: n, i, j, mni
      integer(8) ::cnt
      integer, allocatable :: p(:)

      read *, n
      allocate( p(n) )
      read *, p

      cnt = 0
      mni = p(1)
      do i = 1, n
        if ( mni < p(i) ) then
        else
          cnt = cnt + 1
          mni = p(i)
        end if
      end do
      print *, cnt

end program main



Measured memory_bytes: 1536
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string s = Console.ReadLine();
    int n = s.Length;
    int answerFirst = -1;
    int answerSecond = -1;

    for(int i = 0; i < n-1; i++)
    {
      if(s[i] == s[i+1])
      {
        answerFirst = i+1;
        answerSecond = i+2;
      }
    }

    for(int i = 0; i < n-2; i++)
    {
      if(s[i] == s[i+2])
      {
        answerFirst = i+1;
        answerSecond = i+3;
      }
    }

		Console.WriteLine(answerFirst+" "+answerSecond);
	}
}

Measured memory_bytes: 13140
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

sub = 1000000
for i in range(N):
    temp = T - H[i]*0.006
    nsub = abs(A-temp)
    if sub > nsub:
        sub = nsub
        ans = i

print(ans+1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    vector<double> v(N);
    REP(i, N) cin >> v[i];

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

    REP(i, N-1) {
        v[i+1] = (double(v[i]) + double(v[i+1])) / 2;
    }
    cout << fixed << setprecision(10) << v[N-1] << endl;
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
    string s;
    int i = 0, j = 0, a = 0, b = 0, mi, ma;
    cin >> s;

    while((s.size() - 1 - i >= 0) && (s[i] != 'A'))
    {
        a++;
        i++;
    }

    while((s.size() - 1 - j >= 0) && (s[s.size() - 1 - j] != 'Z'))
    {
        b++;
        j++;
    }

    cout <<s.size() - b - a ;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  if(N == 1){
    cout << "Hello World" << endl;
  }else{
    int A, B; cin >> A >> B;
    cout << A+B << endl;
  }
}

Measured memory_bytes: 3580
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] blue = new String[n];
		for (int i=0;i<n;i++)
			blue[i] = sc.next();
		int m = sc.nextInt();
		String[] red = new String[m];
		for (int i=0;i<m;i++)
			red[i] = sc.next();
		Arrays.sort(blue);
		Arrays.sort(red);
		int ans = 0;
		int temp = 0;
		for (int i=0;i<n;) {
			String s = blue[i];
			temp = 1;
			for (i++;i<n;i++) {
				if (!s.equals(blue[i]))
					break;
				temp++;
			}
			if (ans>=temp)
				continue;
			for (int j=0;j<m;j++) {
				if (s.equals(red[j])) {
					temp--;
					for (j++;j<m;j++) {
						if (!s.equals(red[j]))
							break;
						temp--;
					}
					break;
				}
			}
			if (ans<temp)
				ans = temp;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;



int main() {
    int N;
    cin>>N;
    vector<int> A(N);
    set<int> list;
    rep(i,N){
        cin>>A.at(i);
        list.insert(A.at(i));
    }
    sort(A.begin(),A.end());
    vector<int> check(N,1);//調べる価値
    rep(i,N-1){
        if(A.at(i)==A.at(i+1)){
            check.at(i)=0;
            check.at(i+1)=0;
        }
    }
    int ans=0;
    rep(i,N){
        if(check.at(i)){
            int p=A.at(i);
            bool judge=true;
            for(int j=1;j*j<=p;j++){
                if(p%j==0){
                    if(j!=p && list.count(j)){
                        judge=false;
                    }
                    if((p/j)!=p && list.count(p/j)){
                        judge=false;
                    }
                }
            }
            if(judge)ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 14276
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
    int a,b,c,d;
    while(~scanf("%d%d%d%d",&a,&b,&c,&d))
    {
        int sum = 0;
        sum += a < b ? a : b;
        sum += c < d ? c : d;
        printf("%d\n",sum);
    }
    return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    multiset<ll, greater<ll>> s;
    for(ll i = 0; i < (1 << n); ++i){
        ll si;
        cin >> si;
        s.insert(si);
    }

    multiset<ll, greater<ll>> s2;
    s2.insert(*s.begin());
    s.erase(s.begin());
    while(!s.empty()){
        multiset<ll, greater<ll>> s3;
        for(auto it = s2.begin(); it != s2.end(); ++it){
            auto it2 = s.upper_bound(*it);
            if(it2 == s.end()){
                cout << "No" << endl;
                return 0;
            }else{
                s3.insert(*it2);
                s.erase(it2);
            }
        }
        s2.insert(s3.begin(), s3.end());
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 18688