akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true)
        {
            int i = 0,j = 0;
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0)
                break;
            for(i = 0 ; i < H ; i++)
            {
                if(i == 0 || i == (H - 1))
                {
                    for(j = 0 ; j < W ; j++)
                        System.out.print("#");
                }
                else
                {
                    System.out.print("#");
                    for(j = 0 ; j < W - 2; j++)
                        System.out.print(".");
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 33036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const int MOD = 1000000007;

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N);
    vector<ll> front(N);
    vector<ll> back(N);
    ll sum_front = 0;
    for (int i = 0; i < N; i++) {
      ll d;
      cin >> d;
      a[i] = d;
      sum_front += d;
      front[i] = sum_front;
    }
    ll sum_back = 0;
    for (int i = a.size() - 1; i >= 0; i--) {
      sum_back += a[i];
      back[i] = sum_back;
    }
    ll out = INF;
    for (int i = 0; i< N-1; i++){
      out = min(out, abs(front[i] - back[i + 1]));
    }
    cout << out << endl;
    return 0;
}

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

int n,k;
ll arr[100005];
ll dp[101][100005];
ll dp2[101][100005];
const ll MOD=1000000007;

int main() {
    cin >> n >> k;
    for (int i=1;i<=n;i++) {cin >> arr[i];}

    for (int j=0;j<=k;j++) {dp2[0][j]=1;}
    for (int i=1;i<=n;i++) {
        for (int j=0;j<=k;j++) {
            if (j<=arr[i]) {dp[i][j]=dp2[i-1][j];}
            else {dp[i][j]=dp2[i-1][j]-dp2[i-1][j-arr[i]-1];}
            dp[i][j]=(dp[i][j]+MOD)%MOD;
            if (j>0) {dp2[i][j]=dp2[i][j-1]+dp[i][j];}
            else {dp2[i][j]=dp[i][j];}
            dp2[i][j]=(dp2[i][j]+MOD)%MOD;
        }
    }
    cout << dp[n][k] << endl;

}


Measured memory_bytes: 160464
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define ld long double
 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i>b;i--)
 
#define pb push_back
#define mp make_pair
#define all(A) A.begin(),A.end()
#define allr(A) A.rbegin(),A.rend()
#define precise(i) fixed << setprecision(i)
#define fi first
#define se second
 
#define err() cout<<"\n==================================\n";
#define errA(A) for(auto i:A) cout<<i<<" "; cout<<"\n";
#define err1(a) cout<<#a<<" "<<a<<"\n";
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<"\n";
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<"\n";
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<"\n";
 
const int logN = 20;
const int M = 1000000007;
const int INF = 1e12;
#define PI 3.14159265;
const int N = 200005;
 
#define Pii pair<int,int>
#define Vi vector<int>
#define Vpii vector<Pii>
 
void solve()
{
       int n,m,k,tot=0,num=0,best=-1;
       cin>>n>>m>>k;
       int p1=-1,p2=0;
       int a[n],b[m];
       rep(c,0,n)
       {
              cin>>a[c];
       }
       rep(c,0,m)
       {
              cin>>b[c];
       }
       rep(c,0,n)
       {
              if((tot+a[c])<=k)
              {
                     tot+=a[c];
                     num++;
                     p1=c;
              }
              else
              {
                     break;
              }
       }
       while(p1>=-1)
       {
              while((p2<m) && ((tot+b[p2])<=k))
              {
                     tot+=b[p2++];
                     num++;
              }
              best=max(num,best);
              if(p1==-1)
              {
                     break;
              }
              tot-=a[p1];
              p1--;
              num--;
       }
       cout<<best;
}
 
int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)
    {
           solve();
    }
    return 0;
}

Measured memory_bytes: 6764
n, m = map(int, input().split())
cnt_ac = [False]*(n+1)
cnt_wa = [0]*(n+1)
ac, wa = 0, 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC' and not cnt_ac[p]:
    ac += 1
    cnt_ac[p] = True
  elif s =='WA' and not cnt_ac[p]:
    cnt_wa[p] += 1

for i in range(n+1):
  if cnt_ac[i]: wa += cnt_wa[i]
print(ac, wa)

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

int main() {
    int n, k;
    cin >> n >> k;
    rep(i,n) {
        int a;
        cin >> a;
    }

    int ans = 1;
    n -= k;

    while(n > 0) {
        ans++;
        n -= k - 1;
    }

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

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

int main(){
    int n;
    cin>>n;
    
    rep(i,50000){
        int a = i*1.08;
        if(a==n){
            cout << i<< endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    
    return 0;
}


Measured memory_bytes: 256
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]

S=set(s[i] for i in range(n))
L=len(S)
x = list(S)
a=[0]*(L+1)
for i in range(L):
    a[i]=s.count(x[i])-t.count(x[i])
print(max(a))


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

int main(){
	int n, m;
	while(cin >> n >> m){
		vector<int> v1, v2;
		int s1=0,s2=0;
		if(n == 0 && m == 0) break;
		for(int i = 0; i < n; i++){
			int input;
			cin >> input;
			v1.push_back(input);
			s1 += input;
		}

		for(int i = 0; i < m; i++){
			int input;
			cin >> input;
			v2.push_back(input);
			s2 += input;
		}

		sort(v1.begin(),v1.end());
		sort(v2.begin(),v2.end());

		const int INF (1 << 24);
		int a = INF, b = INF;

		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				if(s1 - v1[i] + v2[j] == s2 - v2[j] + v1[i] && v1[i] + v2[j] < a + b){
					a = v1[i];
					b = v2[j];
				}
			}
		}
		if(a == INF || b == INF) cout << "-1" << endl;
		else cout << a << " " << b << endl;
	}
}

Measured memory_bytes: 1220
N = int(input())
names = [input() for _ in range(N)]

# print(names)

count = 0
candidate = ["M", "A", "R", "C", "H"]

M = len(sorted([name for name in names if name[0] == candidate[0]]))
A = len(sorted([name for name in names if name[0] == candidate[1]]))
R = len(sorted([name for name in names if name[0] == candidate[2]]))
C = len(sorted([name for name in names if name[0] == candidate[3]]))
H = len(sorted([name for name in names if name[0] == candidate[4]]))

ans = M * A * R + M * A * C + M * A * H + M * R * C + M * R * H + M * C * H + A * R * C + A * R * H + A * C * H + R * C * H 

print(ans)

Measured memory_bytes: 11748
//#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cstring>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<iterator>
#include<algorithm>
#include<bitset>

#define Filein(N) freopen("N", "r", stdin);
#define Fileout(N) freopen("N", "w", stdout);
#define sci(x) scanf("%d", &x)
#define sci2(x,y) scanf("%d%d", &x,&y)
#define scll2(x,y) scanf("%lld%lld",&x,&y)
#define scll(x) scanf("%lld",&x)
#define scd(x) scanf("%lf", &x)
#define scstr(x) scanf("%s", x)
#define pfi(x) printf("%d", x)
#define pfll(x) printf("%lld", x)
#define pfd(x) printf("%f", x)
#define pfstr(x) printf("%s", x)
#define ps printf(" ")
#define pn printf("\n")
#define pfdt printf("..")

#define For(var,start,end) for(int var=start; var<=end;i++)
#define rFor(var,start,end) for(int var=start; var>=end; i--)
#define TestCase int testcase, cs=1; cin>>testcase;while(testcase--)

#define mkp make_pair
#define pb push_back
#define fi first
#define se second

#define px(x) cout<<"X -> "<<x<<endl;
#define py(x) cout<<"Y = "<<x<<endl;
#define pz(x) cout<<"Z >> "<<x<<endl;
#define pstr(x) printf("%s\n",x);

using namespace std;
using ll = long long;
using vi = vector <int>;
using mpii = map<int,int>;
using si = set<int>;
using sll = set<ll>;
using vll= vector<ll>;

#define INF 1000000000
#define LINF 4000000000000000000
#define pi  (2*acos(0))
#define Mod 1000000007

 int main(){

 int n,k;
 sci2(n,k);
 int ar[n];
 For(i,0,n-1) sci(ar[i]);
 sort(ar,ar+n);

 int sum = 0;

 For(i,0,k-1){
  sum+=ar[i];
 }
 pfi(sum);pn;






    return 0;
}







Measured memory_bytes: 3724
N, M = list(map(int, input().split(" ")))
A_list = list(map(int, input().split(" ")))

count = 0
sum_A = sum(A_list)
for i in A_list:
    if i >= sum_A/(4*M):
        count += 1

if count >= M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int K;
ull A[100000 + 5];
ull check(ull x) {
  for (int i = 0; i < K && x; ++i) {
    int c = A[i];
    x = x - (x % A[i]);
  }
  return x;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> K;
  for (int i = 0; i < K; ++i) {
    cin >> A[i];
  }

  // find low
  ull l = 1;
  ull r = LLONG_MAX;
  ull ret1 = -1;
  while (l <= r) {
    ull x = l + (r - l) / 2;
    if (check(x) >= 2) {
      ret1 = x;
      r = x - 1;
    } else
      l = x + 1;
  }


  // find up
  l = 1;
  r = LLONG_MAX;
  ull ret2 = -1;
  while (l <= r) {
    ull x = l + (r - l) / 2;
    // cerr << "x: " << x << '\n';
    if (check(x) <= 2) {
      ret2 = x;
      l = x + 1;
    } else
      r = x - 1;
  }
  // cerr << ret1 << " " << ret2 << endl;
  if (ret1 > ret2) {
    cout << -1;
  } else cout << ret1 << " " << ret2;
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll n, x; cin >> n >> x;

    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }

    ll ans = 0;

    ans += max(0ll, a[0] - x);

    a[0] -= max(0ll, a[0] - x);

    for (int i = 0; i < n-1; ++i) {
        if (a[i+1] + a[i] > x) {
            ans += a[i+1] + a[i] - x;

            a[i+1] -= a[i+1] + a[i] - x;
        }
    }

    cout << ans << endl;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> mat(n, vector<int>(m));
    vector<int> vec(m);
    vector<int> ans(n);
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> mat[i][j];
        }
    }
    for(int i = 0; i < m; i++){
        cin >> vec[i];
    }
    for (int i = 0; i < n; i++){
        int sum = 0;
        for (int j = 0; j < m; j++){
            sum += mat[i][j] * vec[j];
        }
        ans[i] = sum;
    }
    for (int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 3180
N = int(input())

memo = [N+1] * (N+1)

memo[0] = 0
memo[1] = 1

exp_sixs = []
exp_nines = []

for i in range(1, 100000):
    if 6 ** i <= N:
        exp_sixs.append(6**i)
    else:
        break

for i in range(1, 100000):
    if 9 ** i <= N:
        exp_nines.append(9**i)
    else:
        break

# print(exp_sixs)
# print(exp_nines)
for exp_six  in exp_sixs:
    memo[exp_six] = 1

for exp_nine in exp_nines:
    memo[exp_nine] = 1

for i in range(1, N+1):
    #1つ前の値から出した値
    one_result = memo[i-1] + 1

    #6の累乗分前の値から出した値
    six_result = N+1
    for exp_six in exp_sixs:
        if (i - exp_six) >= 0:
            six_result = min(six_result, memo[i-exp_six] + 1)
        else:
            break

    #9の累乗分前の値から出した値
    nine_result = N+1
    for exp_nine in exp_nines:
        if (i - exp_nine) >= 0:
            nine_result = min(nine_result, memo[i-exp_nine] + 1)
        else:
            break
    memo[i] = min(one_result, six_result, nine_result)
print(memo[N])


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

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

    LL ans = 0;
    REP(i,N){
        if((i+1)%3==0) continue;
        if((i+1)%5==0) continue; 
        ans += i+1;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3604
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(m):
        u,v,w=map(int,input().split())
        u-=1; v-=1
        E[u].append((v,w))
        E[v].append((u,-w))

    pos=[INF]*n # position
    def dfs(v)->NoneType:
        if(pos[v]!=INF): return
        pos[v]=0
        Q=[v]
        while(Q):
            v=Q.pop()
            for nv,w in E[v]:
                if(pos[nv]==INF):
                    pos[nv]=pos[v]+w
                    Q.append(nv)
                else:
                    if(pos[nv]!=pos[v]+w):
                        print("No")
                        exit(0)

    for v in range(n): dfs(v)
    print("Yes")
resolve()

Measured memory_bytes: 78368
inputs = input().split()
n = int(inputs[0])
m = int(inputs[1])
l = []
r = []
for i in range(0,m):
    inputs = input().split()
    l.append(int(inputs[0]))
    r.append(int(inputs[1]))
result = min(r) - max(l) + 1
if result > 0:
    print(result)
else:
    print(0)


Measured memory_bytes: 11020
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  int n, i;
  readf("%s %s\n", &n, &i);
  writeln(n - i + 1);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
 
using namespace std;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int K, X;

	cin >> K >> X;

	int a = 500 * K;

	if(a >= X) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

}


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

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

    std::vector<std::vector<int>> max_square(H, std::vector<int>(W, 0));
    int maximum_length = 0;
    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            int val;
            std::cin >> val;
            if (val == 0) {
                if (x == 0 || y == 0) {
                    max_square[y][x] = 1;
                } else {
                    max_square[y][x] = std::min(
                        std::min(max_square[y - 1][x - 1], max_square[y - 1][x]),
                        max_square[y][x- 1]
                        ) + 1;
                }

            } else {
                max_square[y][x] = 0;
            }
            if (max_square[y][x] > maximum_length) {
                maximum_length = max_square[y][x];
            }
        }
    }

    std::cout << maximum_length * maximum_length << std::endl;
}



Measured memory_bytes: 10436
class Node:
    def __init__(self):
        self.id = -1
        self.parent = None
        self.childs = []

    def parentId(self):
        return -1 if self.parent == None else self.parent.id

    def depth(self):
        r = 0
        p = self.parent
        while p != None:
            r += 1
            p = p.parent
        return r

    def type(self):
        if self.parent == None:
            return "root"
        elif len(self.childs) > 0:
            return "internal node"
        return "leaf"

    def childIds(self):
        return [c.id for c in self.childs]


n = int(input())
nodes = [Node() for _ in range(n)]

for i in range(n):
    id, k, *c, = map(int, input().split())
    p = nodes[id]
    p.id = id
    for v in c:
        p.childs.append(nodes[v])
        nodes[v].parent = p

for node in nodes:
    s = f"node {node.id}: "
    s += f"parent = {node.parentId()}, "
    s += f"depth = {node.depth()}, "
    s += f"{node.type()}, "
    s += f"{node.childIds()}"
    print(s)



Measured memory_bytes: 40016
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	long long N;
	long long D;
	cin >> N >> D;

	long long X, Y, V;
	long long ans = 0;

	for (long long i = 0; i < N; i++) {
		cin >> X >> Y;
		V = X * X + Y * Y;
		if (V <= (D * D)) {
			ans += 1;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
str memo[200000];
bool calc[200000];
int use[10];
int cost[10];
int n,m;
str larger (str a,str b){
    if(a[0]=='-' && b[0]=='-'){return b;}
    else if(b[0]=='-'){return a;}
    else if(a[0]=='-'){return b;}
    else if(a.size()>b.size())return a;
    else if(a.size()<b.size())return b;
    else{
        for(int i=0;i<a.size();i++){
            if(a[i]>b[i]){return a;}
            else if(a[i]<b[i]){return b;}
        }
        return a;
    }
}
str dp (int x){
    if(x==0)return "";
    else if(x<0)return "-";
    else if(calc[x])return memo[x];
    else{
        str mx = "-";
        for(int i=1;i<=9;i++){
            if(use[i]){
                str tmp = "";
                tmp+=char(i+48);
                mx = larger (mx, dp (x-cost[i]) + tmp );
            }
        }
        memo[x]=mx;
        calc[x]=true;
        return mx;
    }
}
int main(){
    cost[1]=2;
    cost[2]=5;
    cost[3]=5;
    cost[4]=4;
    cost[5]=5;
    cost[6]=6;
    cost[7]=3;
    cost[8]=7;
    cost[9]=6;
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        int temp;
        cin>>temp; use[temp]=true;
    }
    cout<<dp(n)<<endl;
}


Measured memory_bytes: 31104
#include <bits/stdc++.h>
#define MAX_M 60
using namespace std;
int N, M, L, e[MAX_M][3];
int main(void){
	cin >> L;
	N = floor(log2(L)) + 1;
	M = 0;
	for(int i=1; i<N; i++){
		int m = M;
		e[m][0] = i;
		e[m][1] = i+1;
		e[m][2] = 0;
		M++;
	}
	for(int i=1; i<N; i++){
		int m = M;
		e[m][0] = i;
		e[m][1] = i+1;
		e[m][2] = pow(2, i-1);
		M++;
	}
	for(int i=N-1; i>=1; i--){
		if(L - pow(2, i-1) >= pow(2, N-1)){
			int m = M;
			e[m][0] = i;
			e[m][1] = N;
			e[m][2] = L - pow(2, i-1);
			M++;
			L -= pow(2, i-1);
		}
	}
	cout << N << ' ' << M << endl;;
	for(int m=0; m<M; m++) cout << e[m][0] << ' ' << e[m][1] << ' ' << e[m][2] << endl;
}

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

int main()
{
    const ll m = 1e9+7;
    string s;
    cin >> s;
    int n = s.size();

    vector<vector<ll>> dp(n+1, vector<ll>(13, 0));
    dp[0][0] = 1;

    rep(i,n) {
        rep(j,10) {
            int a = (s[i] == '?' ? j : s[i]-'0');
            rep(k,13) {
                int nj = (k*10+a) % 13;
                dp[i+1][nj] += dp[i][k];
                dp[i+1][nj] %= m;
            }
            if(s[i] != '?') break;
        }
    }

    cout << dp[n][5] << endl;
    return 0;
}

Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

ll dp[101][100001];

int main() {
	int N, W;
	cin >> N >> W;
	vector<int> w(N), v(N);
	memset(dp, 0, sizeof(dp));
	rep(i,N) cin >> w[i] >> v[i];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= W; j++) {
			if (j - w[i] >= 0) {
				dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
			} else {
				dp[i+1][j] = dp[i][j];
			}
		}
	}
	cout << dp[N][W] << endl;
}

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

int main() {
	char nn;
	cin >> nn;

	if (nn == 'a') {
		cout << "vowel" << endl;

	}
	else if (nn == 'a') {
		cout << "vowel" << endl;

	}
	else if (nn == 'e') {
		cout << "vowel" << endl;

	}
	else if (nn == 'i') {
		cout << "vowel" << endl;

	}
	else if (nn == 'o') {
		cout << "vowel" << endl;

	}
	else if (nn == 'u') {
		cout << "vowel" << endl;

	}
	else {
		cout << "consonant" << endl;

	}


}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n, cnt = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int flag = 1;
    while(flag){
        flag = 0;
        for(int j = n-1; j >= 1; j--){
            if(a[j] < a[j-1]){
                swap(a[j], a[j-1]);
                flag = 1;
                cnt++;
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(i == n - 1)cout << a[i] << endl;
        else cout << a[i] << " ";
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> ret(n + 1);
    for (int i = 1; i * i <= n; i++) {
        for (int j = 1; j * j <= n; j++) {
            for (int k = 1; k * k <= n; k++) {
                int ans = i * i + j * j + k * k + i * j + j * k + k * i;
                if (ans <= n)ret[ans]++;
            }
        }
    }

    for (int i = 1; i <= n; i++)cout << ret[i] << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define idk tuple<int, int, int, int>
using namespace std;
long double dist[1003][1003];
long double mindist[1003];
vector<tuple<int, int, int, int>> edges;
int main(){
    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    int n ;cin >> n;
    idk f(x1, y1, 0, 0);
  	edges.push_back(f);
  	idk g(x2, y2, 0, 1);
  	edges.push_back(g);
  	for (int i = 2; i < n + 2; i++){
		int x, y, z; cin >> x >> y >> z;
		idk g(x, y, z, i);
		edges.push_back(g);
	}
	for (int i = 0; i < edges.size(); i++){
		int x, y, r, idx; tie(x, y, r, idx) = edges[i];
		mindist[idx] = -1.0;
		for (int j = 0; j < edges.size(); j++){
			int x1, y1, r1, idx1; tie(x1, y1, r1, idx1) = edges[j];
			if (idx == idx1) {dist[idx][idx1] = 0.0; continue;}
			long double length = max((long double)0.0, hypot((long double)abs(x1 - x), (long double)abs(y1 - y)) - r - r1);
			dist[idx][idx1] = length;
		}
	}
	priority_queue<pair<long double, int>, vector<pair<long double, int>>, greater<pair<long double, int>>> pq;
	pq.push({0.0, 0});
	while (!pq.empty()){
		long double d; int node; tie(d, node) = pq.top();
		pq.pop();
		if (mindist[node] != -1.0) continue;
		mindist[node] = d;
		for (int i = 0; i < edges.size(); i++){
			if (i != node){
				pq.push({d + dist[node][i], i});
			}
		}
	}

	cout << fixed << setprecision(10) << mindist[1] << '\n';
}


Measured memory_bytes: 50936
s = input()
first = int(s[:2])
second = int(s[2:])

def judge_1_12(n):
    if n > 0 and n < 13:
        return True
    else:
        return False

if judge_1_12(first) or judge_1_12(second):
    if judge_1_12(first) and judge_1_12(second):
        print("AMBIGUOUS")
    elif not judge_1_12(first):
        print("YYMM")
    else:
        print("MMYY")
else:
    print("NA")


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

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    long long A, B;
    cin >> A >> B;
    cout << A / GCD(A, B) * B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=100007;
int n,pw[N][2],pp=0,mx,L,R,M;
struct pos{
	int x,id,w;
	bool operator<(const pos&p)const{return x<p.x;}
}ps[N*2];
int dfn[N],low[N],scc[N],tk=0,ss[N],sp=0,I[N],tr1[N],tr2[N],ep,e0[N];
struct edge{
	int to,nx;
}e[N*100];
bool in[N];
void mins(int&a,int b){if(a>b)a=b;}
void tj(int w){
	dfn[w]=low[w]=++tk;
	in[ss[++sp]=w]=1;
	for(int i=e0[w];i;i=e[i].nx){
		int u=e[i].to;
		if(!dfn[u]){
			tj(u);
			mins(low[w],low[u]);
		}else if(in[u])mins(low[w],dfn[u]);
	}
	if(dfn[w]==low[w]){
		int u;
		do in[u=ss[sp--]]=0,scc[u]=w;while(u!=w);
	}
}
void ae(int a,int b){
	e[ep]=(edge){b,e0[a]};e0[a]=ep++;
}
void ae1(int w,int l,int r){
	if(l>r)return;
	if(l<=w&&w<=r)ae1(w,l,w-1),ae1(w,w+1,r);
	else for(w+=mx,l+=mx-1,r+=mx+1;r-l>1;l>>=1,r>>=1){
		if(~l&1)ae(w,tr1[l+1]);
		if(r&1)ae(w,tr1[r-1]);
	}
}
void ae2(int w,int l,int r){
	if(l>r)return;
	if(l<=I[w]&&I[w]<=r)ae2(w,l,I[w]-1),ae2(w,I[w]+1,r);
	else for(w+=mx,l+=mx-1,r+=mx+1;r-l>1;l>>=1,r>>=1){
		if(~l&1)ae(tr2[l+1],w);
		if(r&1)ae(tr2[r-1],w);
	}
}
bool chk(){
	for(int i=0;i<mx*3;++i)dfn[i]=0,e0[i]=0;ep=2;
	for(int i=2;i<mx;++i)ae(i/2,i),ae(mx*2+i,mx*2+i/2);
	for(int i=1;i<=pp;++i){
		int j=I[i],l0,r0;
		ae(mx+i>>1,mx+j);
		ae(mx+i,mx*2+(mx+i>>1));
		l0=std::upper_bound(ps+1,ps+pp+1,(pos){ps[i].x-M})-ps;
		r0=std::lower_bound(ps+1,ps+pp+1,(pos){ps[i].x+M})-ps-1;
		ae1(i,l0,r0);
		ae2(j,l0,r0);
	}
	tj(1);
	for(int i=1;i<=n;++i)if(scc[mx+pw[i][0]]==scc[mx+pw[i][1]])return 0;
	return 1;
}
int main(){
	scanf("%d",&n);
	for(int i=1,x,y;i<=n;++i){
		scanf("%d%d",&x,&y);
		ps[++pp]=(pos){x,i,0};
		ps[++pp]=(pos){y,i,1};
	}
	std::sort(ps+1,ps+pp+1);
	for(mx=1;mx<pp+2;mx<<=1);
	for(int i=1;i<=pp;++i)pw[ps[i].id][ps[i].w]=i;
	for(int i=1;i<=pp;++i){
		int x=pw[i][0],y=pw[i][1];
		I[x]=y,I[y]=x;
	}
	for(int i=1;i<mx;++i)tr1[i]=i,tr2[i]=mx*2+i;
	for(int i=1;i<=pp;++i)tr1[mx+i]=mx+I[i],tr2[mx+i]=mx+i;
	L=0,R=1e9;
	while(L<R){
		M=L+R+1>>1;
		if(chk())L=M;
		else R=M-1;
	}
	printf("%d\n",L);
	return 0;
}

Measured memory_bytes: 18816
from bisect import bisect_left
N = int(input())
L_list = list(map(int, input().split()))
L_list.sort()

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        a, b = L_list[i], L_list[j]
        r = bisect_left(L_list, a+b)
        ans += max(0,r-j-1)
print(ans)


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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }

inline void proc_status()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) <<endl;
}

template <typename T> T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

const int Maxn = 400 + 100;
const LL inf = 0x3f3f3f3f3f3f3f3f;

int N, A[Maxn];
LL Sum[Maxn], Dp[Maxn][Maxn];

inline LL Calc (int l, int r) { return Sum[r] - Sum[l - 1]; }

inline void Solve ()
{
	for (int i = 1; i <= N; ++i) Sum[i] = Sum[i - 1] + A[i];

	for (int l = 2; l <= N; ++l)
	{
		for (int i = 1; i + l - 1 <= N; ++i)
		{
			int j = i + l - 1;
			Dp[i][j] = inf;
			for (int k = i; k < j; ++k) Chkmin(Dp[i][j], Dp[i][k] + Dp[k + 1][j] + Calc(i, k) + Calc(k + 1, j));
		}
	}

	cout<<Dp[1][N]<<endl;
}

inline void Input ()
{
	N = read<int>();
	for (int i = 1; i <= N; ++i) A[i] = read<int>();
}

int main()
{
#ifdef hk_cnyali
	freopen("N.in", "r", stdin);
	freopen("N.out", "w", stdout);
#endif
	Input();
	Solve();
	return 0;
}


Measured memory_bytes: 1792
import sys
import math
import numpy as np
import copy

def dfs(now, group, groups, edges):
    if groups[now] != -1:
        return 0
    groups[now] = group
    cnt = 1
    for to in edges[now]:
        cnt += dfs(to, group, groups, edges)
    return cnt

def main():
    n, m, k = map(int, input().split())
    edges = [list() for i in range(n)]
    ngs = [list() for i in range(n)]
    for i in range(m):
        a, b = map(int, input().split())
        a, b = a-1, b-1
        edges[a].append(b)
        edges[b].append(a)
    for i in range(k):
        c, d = map(int, input().split())
        c, d = c-1, d-1
        ngs[c].append(d)
        ngs[d].append(c)


    cnt = 0
    groups = [-1 for i in range(n)]
    nodes_cnt = list()

    ans = [0 for i in range(n)]
    
    for i in range(n):
        if groups[i] == -1:
            nodes_cnt.append(dfs(i, cnt, groups, edges))
            cnt += 1
        ans[i] = nodes_cnt[groups[i]] - len(edges[i]) - 1
        for ng in ngs[i]:
            if groups[i] == groups[ng]:
                ans[i] -= 1

    print(*ans, sep=" ")

if __name__ == '__main__':
    sys.setrecursionlimit(1000000)
    sys.exit(main())

Measured memory_bytes: 84444
#include<stdio.h>
#include<math.h>
 
#define MAX 10000
int isprime(int);
int main(){
 
  int i;
  int num;
  int cnt = 0;
  int temp;
 
  scanf("%d",&num);
 
  for(i = 0;i < num;i++){
 
    scanf("%d",&temp);
 
    if(isprime(temp) == 0){
      cnt++;
    }
  }
 
  printf("%d\n",cnt);
 
  return 0;
}



int isprime(int x){
 
  int i;
 
  if(x == 2){
    return 0;
  }
 
  if(x < 2 || x%2 == 0){
    return -1;
  }
 
  for(i = 3;i <= sqrt(x);i += 2){
    if(x%i == 0){
      return -1;
    }
  }
 
  return 0;
}
 

Measured memory_bytes: 596
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int k;
    cin >> k;

    ll sm = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                sm += gcd(gcd(a, b), c);
            }
        }
    }

    cout << sm << "\n";
    return 0;
}

Measured memory_bytes: 3652
import java.util.*;
 
class Main {
	
    public static void main(String[] args) {
         
        Scanner cin=new Scanner(System.in);
        while(true) {
        	
        	int n=cin.nextInt();
        	if(n==0)break;
        	
        	List<Integer> data = new ArrayList<>();
        	
        	for(int i=0;i<n;i++)data.add(cin.nextInt());
        	
        	Collections.sort(data);
        	
        	int res=1000000;
        	
        	for(int i=0;i<n-1;i++) res=Math.min(data.get(i+1)-data.get(i), res);
        	
        	System.out.println(res);
        	
        }
        
    }
}


Measured memory_bytes: 48252
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
#define P pair<int,int>

signed main(){
    int R;
    cin >> R;
    if(R<1200){
        cout << "ABC" << endl;
    }else if(R<2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
    
	return 0;
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

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

const lli MOD = 1000000007LL;

lli modpow(lli a, lli n){
    lli res = 1;

    for(lli ai = a; n; n>>=1){
        if(1&n) res = (res*ai)%MOD;
        ai=(ai*ai)%MOD;
    }
    return res;
}

lli inv(lli n){
    return modpow(n, MOD-2);
}

lli modperm(lli n, lli k){
    lli res = 1;
    rep(i, k){
        res = (res*(n-i))%MOD;
    }
    return res;
}

lli modcomb(lli n, lli k){
    return (modperm(n, k)*inv(modperm(k, k)))%MOD;
}

lli posmod(lli n){
    lli res = n;
    res %= MOD;
    if(res < 0) res += MOD;
    return res;
}
int n;
string s;
unordered_map<string, int> m;

int main(void){
    cin >> n;
    rep(i, n){
        cin >> s;
        m[s]++;
    }
    cout << m.size() << endl;
    return 0;
}


Measured memory_bytes: 17584
#include<stdio.h>

int main(void){
  int m,d,d1,d2,i,j,ans=0;
  scanf("%d %d",&m,&d);
  for(i=1;i<=m;i++){
    for(j=2;j<=d;j++){
      d1 = j/10;
      d2 = j%10;
      if((d1>1 && d2>1) && (d1*d2==i)) ans++;
    }
  }
  printf("%d\n",ans);
  return 0;
}

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

int main(){
    vector<int> v(5);
    cin >> v[0] >> v[1] >> v[2] >> v[3] >> v[4];

    int ans = 1000;
    do {
        int t = 0;
        for(int i = 0; i < 5; ++t){
            if(t == 0 || t%10 == 0){
                t += v[i++];
                --t;
            }
        }

        ans = min(ans, t);

    } while( next_permutation(begin(v), end(v)) );

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   int x, a,b;
   cin >> x >> a >> b;

   int da = abs(x-a);
   int db = abs(x-b);
   if(da < db){cout << "A"<< endl;}
   else{cout << "B"<< endl;}

   return 0;
}

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

int cal(int x){
    int cnt = 0;
    for(int i = 1; i <= x; i++){
        if(x % i == 0){
            cnt++;
            if(cnt > 8){
                cnt = 0;
                break;
            }
        }
    }
    return cnt;
}

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

    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(i % 2 == 1){
            int tmp = cal(i);
            if(tmp == 8){
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define REP(i,a,b) for (int i = a ; i <= b ; i++)
#define REPI(i,a,b) for (int i = a ; i >= b ; i--)
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int OO = 1e9+7;
const int MOD = 1e9+7;
const int N = 21+1;
const int MSK = (1<<22);

int n;
bool a[N][N];
ll mem[N][MSK];

ll dp(int i,int msk)
{
    ll &ret = mem[i][msk];
    if (ret != -1) return ret;
    if (i == n)
    {
        if (msk == (1<<n)-1) return 1;
        else return 0;
    }
    ret = 0;
    REP(j,0,n-1)
    {
        if (a[i][j] && !(msk&(1<<j))) ret = (ret+dp(i+1,msk|(1<<j)))%MOD;
    }
    return ret;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("teleport.in","r",stdin);
    //freopen("teleport.out","w",stdout);

    memset(mem,-1,sizeof mem);
    cin >> n;
    REP(i,0,n-1) REP(j,0,n-1) cin >> a[i][j];
    cout << dp(0,0) << endl;
    return 0;
}


Measured memory_bytes: 721152
Limit = 100
CMB = [[0]*(Limit+1) for _ in range(Limit+1)]
def cmb_table(Limit):
  for i in range(Limit+1):
    for j in range(Limit+1):
      if j == 0 or j == i: #端っこの場合
        CMB[i][j] = 1
      else:
        CMB[i][j] = CMB[i-1][j-1] + CMB[i-1][j]

cmb_table(Limit)
#print(CMB[0][3])
N,P = map(int,input().split())
A = list(map(int,input().split()))
odd = 0; even = 0
for x in A:
  if x%2 == 0:
    even +=1
  else:
    odd +=1
ans = 0
if P%2 == 0: #偶数の場合
  for x in range(even+1):
    E = x
    if E == 0:
      face = 1
    else:
      face = CMB[even][E]
    O = 0
    while E+O <= N:
      if O == 0:
        faco = 1
      else:
        faco += CMB[odd][O]
      O += 2
    #print(E,face,faco)
    ans += face*faco #どっちも選ばなくてOK
else:
  for x in range(even+1):
    E = x
    if E == 0:
      face = 1
    else:
      face = CMB[even][E]
    O = 1
    while E+O <= N:
      if O == 1:
        faco = CMB[odd][O]
      else:
        faco += CMB[odd][O]
      O += 2
    #print(face,faco)
    ans += face*faco #どっちも選ばなくてOK
    
print(ans)
    
  

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

int main(){
	string s;
	cin >> s;
	for(unsigned int i = 0;i < s.size();i++){
		if(s[i] == ',') s[i] = ' ';
	}

	cout << s << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	ll sx,sy, tx, ty; cin >> sx >> sy >> tx >> ty;

	rep(i, ty - sy) cout << "U";
	rep(i, tx - sx) cout << "R";
	rep(i, ty - sy) cout << "D";
	rep(i, tx - sx) cout << "L";
	cout << "L";
	rep(i, ty - sy + 1) cout << "U";
	rep(i, tx - sx + 1) cout << "R";
	cout << "D";
	cout << "R";
	rep(i, ty - sy + 1) cout << "D";
	rep(i, tx - sx + 1) cout << "L";
	cout << "U" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  while(b <= a && k > 0){
    b *= 2;
    k -= 1;
  }
  while(c <= b && k > 0){
    c *= 2;
    k--;
  }
  if(a < b && b < c) YES;
  else NO;

}

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

int main()
{
    string s,s1,s2;
    int n,i;
    cin>>n;
    cin>>s;
    s1="";
    s2="";
    for(i=0;i<n/2;i++)
    {
        s1+=s[i];
    }
    for(i=n/2;i<n;i++)
    {
        s2+=s[i];
    }
    if(s1==s2)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int MAX { 100010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll st[MAX][256];

ll score(char x, char y, int R, int S, int P)
{
    if (x == 'r' and y == 's')
        return R;

    if (x == 's' and y == 'p')
        return S;

    if (x == 'p' and y == 'r')
        return P;

    return 0;
}

ll solve(int N, int K, int R, int S, int P, const string& T)
{
    ll ans = 0;

    for (int i = 0; i < K; ++i)
    {
        for (auto c : "rsp")
            st[i][c] = score(c, T[i], R, S, P);

        int j;

        for (j = i + K; j < N; j += K)
        {
            for (auto c : "rsp")
            {
                st[j][c] = 0;

                for (auto k : "rsp")
                {
                    if (k == c)
                        continue;

                    st[j][c] = max(st[j][c], score(c, T[j], R, S, P) + st[j - K][k]);
                }
            }
        }

        ans += max({ st[j - K]['r'], st[j - K]['s'], st[j - K]['p'] });
    }

    return ans;
}

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

    int N, K, R, S, P;
    string T;

    cin >> N >> K >> R >> S >> P >> T;

    auto ans = solve(N, K, R, S, P, T);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 200528
s = input()
count = 0
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        count += 1
        if s[i - 1] == '0':
            s = s[:i] + '1' + s[i + 1:]
        else:
            s = s[:i] + '0' + s[i + 1:]
print(count)


Measured memory_bytes: 3432
#include<stdio.h>
#include<string.h>
#include<math.h>

int main(){
	int c1,c2,c3,c,i;
	
	while(~scanf("%d%d%d",&c1,&c2,&c3)){
		c=0;
		
		for(i=1;i<=10;i++){
			if(i!=c1 && i!=c2 && i!=c3 && i+c1+c2<21)++c;
		}
		if(c>3){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
int n,a[N],dp[N];
int main(){
	cin>>n;
	a[0]=999999999;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=2;i<=n;i++){
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int a,b,k;
int main(){
  while(~scanf("%d %d",&a,&b)){
    k=0;
    for(int i=1;i<=min(a,b);i++){
      if(a%i==0&&b%i==0){k=i;}
    }
    printf("%d\n",k);    
  }
}

Measured memory_bytes: 1188
#include <set>
#include <math.h>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <stdio.h>

typedef long long ll;
using namespace std;

int main(){
    char s[11] = "";
    char *ptr;
    ll y,m,d,r;
    cin >> s;
    
    ptr = strtok(s,"/");
    y = (ll)atoi(ptr);
    ptr = strtok(NULL,"/");
    m = (ll)atoi(ptr);
    ptr = strtok(NULL,"/");
    d = (ll)atoi(ptr);
    
    r = y*10000 + m*100 + d;
    if(r > 20190430)
        cout << "TBD" << endl;
    else
        cout << "Heisei" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n,k,R,S,P;
    string t;
    cin>>n>>k>>R>>S>>P>>t;

    int ans=0;
    string s="";
    rep(i,n){
        if(i<k){
            if(t[i]=='r') ans+=P, s+='p';
            else if(t[i]=='s') ans+=R, s+='r';
            else ans+=S, s+='s';
        }
        else{
            if(t[i]!=t[i-k]){
                if(t[i]=='r') ans+=P, s+='p';
                else if(t[i]=='s') ans+=R, s+='r';
                else ans+=S, s+='s';
            }
            else{
                if(t[i]=='r'){
                    if(s[i-k]=='p') s+='r';
                    else ans+=P, s+='p';
                }
                else if(t[i]=='s'){
                    if(s[i-k]=='r') s+='s';
                    else ans+=R, s+='r';
                }
                else{
                    if(s[i-k]=='s') s+='p';
                    else ans+=S, s+='s';
                }
            }
        }
    } 
    //cout<<s<<endl;
    cout<<ans<<endl;
}


Measured memory_bytes: 3756
#![allow(unused_imports)]

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::fmt;
use std::io::{self, BufWriter, Read, StdinLock, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};

fn solve(n: u32) -> u32 {
    n / 3
}

fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}", solve(sc.next()));
}

struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(1024),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        let buf = &mut self.buf;
        buf.clear();
        self.bytes
            .by_ref()
            .map(Result::unwrap)
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
            .foreach(|c| buf.push(c));
        str::from_utf8(&buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
        <T3 as FromStr>::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                self.bytes
                    .by_ref()
                    .map(Result::unwrap)
                    .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
                    .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
                    .map(&mut f)
                    .collect()
            })
            .collect()
    }
}

trait Foreach {
    type Item;
    fn foreach<F: FnMut(Self::Item)>(self, f: F);
}

impl<T, I: Iterator<Item = T>> Foreach for I {
    type Item = T;

    fn foreach<F: FnMut(T)>(self, mut f: F) {
        self.fold((), move |(), x| f(x));
    }
}


Measured memory_bytes: 4352