akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3



def main():
    N = int(input())
    b = list(map(int, input().split()))
    ans = []
    for i in range(N):
        for j in reversed(range(len(b))):
            if b[j]==j+1:
                ans.append(j+1)
                b = b[:j] + b[j+1:]
                #print(j+1, b)
                break
    if len(ans)!=N:
        print(-1)
    else:
        for elem in reversed(ans):
            print(elem)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 505;

char a[MAXN][MAXN], b[MAXN][MAXN], c[MAXN][MAXN];
int n, m;

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read();
	for (int i = 1; i <= n; i ++)
		scanf("%s", c[i] + 1);
	for (int i = 1; i <= n; i ++)
	{
		for (int j = 2; j < m; j ++)
			if (i & 1)
				a[i][j] = '#', b[i][j] = c[i][j];
			else
				b[i][j] = '#', a[i][j] = c[i][j];
		a[i][1] = '#', a[i][m] = '.', b[i][1] = '.', b[i][m] = '#';
	}
	for (int i = 1; i <= n; i ++, putchar(10))
		for (int j = 1; j <= m; j ++)
			putchar(a[i][j]);
	putchar(10);
	for (int i = 1; i <= n; i ++, putchar(10))
		for (int j = 1; j <= m; j ++)
			putchar(b[i][j]);
	return 0;
}


Measured memory_bytes: 1536
using System;
namespace ITP1_1_C {
	class Program {
		static void Main(string[] args) {
			string[] s = Console.ReadLine().Split();
			int a = int.Parse(s[0]), b = int.Parse(s[1]);
			Console.WriteLine((a * b) + " " + (2 * a + 2 * b));
		}
	}
}

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

struct Node
{
    char name[15];
    int t;
};
int main()
{
    int n, q, Time = 0;
    queue<Node> p;
    Node m;
    cin >> n >> q;
    for(int i=0; i<n; i++)
    {
        cin >> m.name >> m.t;
        p.push(m);
    }
    while(!p.empty())
    {
        Node a = p.front(); p.pop();
        if(a.t>q)
        {
            a.t = a.t - q;
            p.push(a);
            Time += q;
        }
        else
        {
            Time += a.t;
            cout << a.name << " " << Time << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 4000
#include <iostream>
#include<cstdio>
using namespace std;
typedef long long LL;
int main()
{
    LL a,b,n,d;
    scanf("%lld%lld%lld",&a,&b,&n);
    if(n<b) d = n;
    else d = b-1;
    printf("%lld\n",a*d/b);
    return 0;
}


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

using namespace std;
const int INF = 1e9 + 5;
int main() {
	int n;
	scanf("%d", &n);
	vector<int>frogs(n);
	//for(int i = 0; i<n;i++) scanf("%d", &frogs[i]);
	for(int &x:frogs) {
	  scanf("%d", &x);
	 }
	vector<int> dp(n, INF);
	dp[0] = 0;
	for(int i = 0; i<n; i++) {
	   for(int j : {i+1, i+2}) {
	   	if(j < n) dp[j] = min(dp[j], dp[i] + abs(frogs[i] - frogs[j]));
	 	}
	 }

	printf("%d", dp[n-1]);
	return 0;

}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>

using namespace std;

int main(void){
	int k;
	cin >> k;

	cout << (k/2) * (((k+1)/2)) << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        MyScanner scn = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        // Solution Start
        int n = scn.nextInt();
        int[] a = new int[n];
        //int m = 1000;
        int k = scn.nextInt();
        for (int i = 0; i < n; i++) {
            a[i] = scn.nextInt();
        }

        /*
        int day = 0;
        int stocks = 0;
        while (day < n) {
            if (day == (n - 1)) {
                if (stocks > 0) {
                    m += stocks * a[day];
                    stocks = 0;
                }
            } else {
                if (a[day] < a[day + 1]) {
                    stocks = m / a[day];
                    m -= a[day] * stocks;
                } else if (day > 0) {
                    if ((a[day - 1] < a[day])) {
                        m += stocks * a[day];
                        stocks = 0;
                    }
                }
            }
            //out.println(m);
            //out.println(stocks);
            //out.println();
            day++;
        }
        out.println(m);
        */

        for (int i = k; i < n; i++) {
            if (a[i] > a[i - k]) out.println("Yes");
            else out.println("No");
        }

        //Solution end
        out.close();
    }


    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}


Measured memory_bytes: 56100
#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(){
    string s;
    cin >> s;
    int n = s.size();
    int a = 0, b = 0;
    rep(i,n){
        if(s[i] == '0') a++;
        else b++;
    }
    cout << min(a,b)*2 << endl;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
  int H,W,i,j; cin >> H >> W;
  rep(i, H){
    string s; cin >> s;
    rep(j, 2){
      cout << s << endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;


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

	if (N % 2 == 0) {
		int M = N / 2;

		if (K > M) { cout << -1 << endl; return 0; }
		for (int i = 0; i < M; i++) {
			cout << M * 3 - i * 2 - 2 + K - M << " " << M * 3 + i + K - M << " " << M * 6 - 1 - i + K - M << endl;
		}
		for (int i = 0; i < M; i++) {
			cout << M * 3 - 1 - i * 2 + K - M << " " << M * 4 + i + K - M << " " << M * 7 - 1 - i + K - M << endl;
		}
	}
	else {
		int M = N / 2;
		if (K > M + 1) { cout << -1 << endl; return 0; }
		for (int i = 0; i < M; i++) {
			cout << M * 3 - i * 2 + K - M - 1<< " " << M * 3 + 1 + i + K - M << " " << M * 6 + 1 - i + K - M << endl;
		}
		for (int i = 0; i <= M; i++) {
			cout << 3 * M - 2 * i + K - M << " " << 4 * M + 1 + i + K - M << " " << 7 * M + 2 - i + K - M << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
#define INF 10000000
using namespace std;

int z[100],n,w[100];
int a[100][100];

void bfs(){
  int m;
  z[0]=0;
  queue<int> q;
  q.push(0);
  while(!q.empty()){
    m=q.front();
    q.pop();
    if(w[m]==1) continue;
    w[m]=1;
    for(int i=0;i<n;i++){
      if(a[m][i]==1){
	q.push(i);
	z[i]=min(z[i],z[m]+1);
      }
    }
  }
}


int main(){
  int p,x;
  for(int i=0;i<100;i++){
    z[i]=w[i]=INF;
    for(int j=0;j<100;j++) a[i][j]=0;
  }
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>p>>p;
    for(int j=0;j<p;j++){
      cin>>x;
      a[i][x-1]=1;
    }
  }
  bfs();
  for(int i=0;i<n;i++){
    if(z[i]!=INF) cout<<i+1<<" "<<z[i]<<endl;
    else cout<<i+1<<" "<<-1<<endl;
  }
  return 0;
}



Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;

using namespace std;

int main(void){
    int r;
    cin>>r;
    cout<<r*r<<endl;
    return 0;
}


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

using namespace std;

using vi=vector<int>;
using vvi=vector<vi>;

bool augment(int l, vvi& E, vi& r2l, vi& visited) {
	if(l == -1) return true;
	if(visited[l]) return false;
	visited[l] = true;
	for(int r:E[l]) {
		if(augment(r2l[r], E, r2l, visited)) {
			r2l[r] = l;
			return true;
		}
	}
	return false;
}

int match(vvi& e, int l, int r) {
	vi r2l(r, -1);
	int res = 0;
	for(int i = 0; i < l; i++) {
		vi visited(l);
		if(augment(i, e, r2l, visited)) res++;
	}
	return res;
}

int main() {
	int m, n;

	while(cin >> m >> n, m) {
		int ans = 0;

		vi B(m), R(n);
		for(auto &i:B) cin >> i;
		for(auto &i:R) cin >> i;

		vvi edge(m);
		for(int i = 0; i < m; i++) {
			for(int j = 0; j < n; j++) {
				if(__gcd(B[i], R[j]) > 1) {
					edge[i].push_back(j);
				}
			}
		}
		cout << match(edge, m, n) << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    auto isOK = [&](ll t){
        ll cnt = 0;
        rep(i,n){
            cnt += (max(h[i] - b * t, 0LL) + (a - b) - 1)/(a - b);
        }
        if(cnt <= t) return true;
        else return false;
    };
    ll ok = 1e9 + 2;
    ll ng = 0;
    while(ok - ng > 1){
        ll mid = (ok + ng)/2;
        if(isOK(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

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

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


int N;
int H[100000];

bool solve(){
    for(int i = N - 1; i > 0; i--){
        if(H[i - 1] - 1 == H[i]){
            H[i - 1] -= 1;
        }else if(H[i - 1] - 1 > H[i]){
            return false;
        }
    }
    return true;
}

signed main(){
    cin >> N;
    REP(i, N) cin >> H[i];
    PRINT(solve() ? "Yes" : "No");
    return 0;
}

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

int f(int a, int b, int c) {
  vector<int> v(3);
  v[0] = a, v[1] = b; v[2] = c;
  sort(v.begin(), v.end());
  return v[2] - v[0];
}

void solve2(int H, int W, int &b, int &c) {
  if(H > W) swap(H, W);
  if(H % 2 == 0) { b = H / 2 * W; c = b; }
  else if(W % 2 == 0) { b = W / 2 * H; c = b; }
  else { b = W / 2 * H; c = W * H - b; }
}

int solve(int H, int W) {
  if(H % 3 == 0 || W % 3 == 0) return 0;
  int a,b,c, ans = INT_MAX;
  a = H / 3;
  solve2(H - a, W, b, c);
  int tmp = f(a * W, b, c); ans = min(ans, tmp);

  a = min(H / 3 + 1, H);
  solve2(H - a, W, b, c);
  tmp = f(a * W, b, c); ans = min(ans, tmp);

  a = W / 3;
  solve2(H, W - a, b, c);
  tmp = f(a * H, b, c); ans = min(ans, tmp);

  a = min(W / 3 + 1, W);
  solve2(H, W - a, b, c);
  tmp = f(a * H, b, c); ans = min(ans, tmp);

  return ans;
}

int main() {
  int H, W;
  cin>>H>>W;
  if(H > W) swap(H, W);
  int ans = solve(H, W);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
A, B, C, X, Y = list(map(int, input().split()))
ans = 10000000000
cost = 0

# C for both A and B
cost = max(X, Y) * C * 2
ans = min(ans, cost)

if X > Y:
    cost = Y * C * 2
    cost1 = cost + (X - Y) * A
    cost2 = cost + (X - Y) * C * 2
    cost = min(cost1, cost2)
    ans = min(ans, cost)
else:
    cost = X * C * 2
    cost1 = cost + (Y - X) * B
    cost2 = cost + (Y - X) * C * 2
    cost = min(cost1, cost2)
    ans = min(ans, cost)

cost = A * X + B * Y
ans = min(ans, cost)

print(ans)

Measured memory_bytes: 9056
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,i,ta,d[202020],has;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>ta;
		d[ta]=d[ta-1]+1;
		has=max(has,d[ta]);
	}
	cout<<n-has<<"\n";
}

Measured memory_bytes: 1792
N = int(input())
P = list(map(int, input().split())) 

cnt = 0
skip = False
for i in range(N):
    if skip:
        skip = False
        continue
    if i+1 == P[i]:
        cnt += 1
        if i+1 < N and i+2 == P[i+1]:
            skip = True

print(cnt)


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	string ss;
	cin >> ss;

	ss.pop_back();
	ss.pop_back();
	string s = ss.substr(0, ss.size()/2);
	while(1){
		if((s + s) == ss){
			cout << s.size() * 2 << endl;
			break;
		}
		s.pop_back();
		ss.pop_back();
		ss.pop_back();
	}
	
	return 0;
}


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

using namespace std;

int main(){
    int n;
    string lb;
    string str;
    int kth;

    cin >> n;
    getline(std::cin, lb);
    getline(std::cin, str);
    cin >> kth;

    char target_c = str[kth-1];

    for(int i=0; i<n; ++i){
        if(str[i] == target_c){
            cout << target_c;
        }else{
            cout << '*';
        }
    }
    cout << endl;
    return 0;
}

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

int main() {
  int N;
  scanf("%d", &N);
  
  set<int> s;
  for (int i = 0; i < N; i++) {
    int A;
    scanf("%d", &A);
    auto itr = s.find(A);
    if (itr != s.end()) {
      s.erase(A);
    } else {
      s.insert(A);
    }
  }

  printf("%lu", s.size());
  return 0;
}

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

int main()
{
    ll t=1,i,j,k,a,b,n,x,y,m;
    string s,st;
    cin>>s>>st;
    n=s.length();
    m=st.length();
    ll cnt,f=0;
    vector<ll>v,u;
    for(i=0;i<n;i++)
    {
       cnt=0;
       for(j=0,k=i;j<m&&(n-i)>=m;j++,k++)
       {
           if(s[k]==st[j])
           {
               cnt++;
           }
       }
       v.push_back(cnt);
    }
    sort(v.begin(),v.end());
    k=v[v.size()-1];
    cout<<m-k<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include<cstdio>
inline int abs(int x){return x<0?-x:x;}
inline void chk(int &x,int y){if(y<x)x=y;}
int n,H[100005];
int dp[100005];
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i)scanf("%d",&H[i]);
	for(int i=1;i<n;++i){
		dp[i]=1e9;
		chk(dp[i],dp[i-1]+abs(H[i]-H[i-1]));
		if(i>1)chk(dp[i],dp[i-2]+abs(H[i]-H[i-2]));
	}
	printf("%d\n",dp[n-1]);
	return 0;
}

Measured memory_bytes: 896
using System;

namespace ConsoleApp__ITP1_2_C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] value = Console.ReadLine().Split(' ');
            int length = value.Length;

            for (int j = length - 1; j > 0; j--)
            {
                for (int i = length - 1; i > 0; i--)
                {
                    if (Int32.Parse(value[i-1]) > Int32.Parse(value[i]))
                    {
                        var x = value[i-1];
                        value[i-1] = value[i];
                        value[i] = x;
                    }
                }
            }

            var separator = " ";
            var result = String.Join(separator, value);
            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 8992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
struct edge
{
    ll to, a, b;
};
const ll MAX_N = 100001;
ll N;
vector<edge> G[MAX_N];
ll ds[MAX_N];
ll de[MAX_N];
const ll INF = 1LL << 60;

void dijkstrae(int s)
{
    priority_queue<P, vector<P>, greater<P>> que;
    rep(i, MAX_N)
    {
        de[i] = INF;
    }
    de[s] = 0;
    que.push(P(0LL, s));
    while (!que.empty())
    {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (de[v] < p.first)
            continue;
        for (int i = 0; i < G[v].size(); i++)
        {
            edge e = G[v][i];
            if (de[e.to] > de[v] + e.a)
            {
                de[e.to] = de[v] + e.a;
                que.push(P(de[e.to], e.to));
            }
        }
    }
}

void dijkstras(int s)
{
    priority_queue<P, vector<P>, greater<P>> que;
    rep(i, MAX_N)
    {
        ds[i] = INF;
    }
    ds[s] = 0;
    que.push(P(0LL, s));
    while (!que.empty())
    {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (ds[v] < p.first)
            continue;
        for (int i = 0; i < G[v].size(); i++)
        {
            edge e = G[v][i];
            if (ds[e.to] > ds[v] + e.b)
            {
                ds[e.to] = ds[v] + e.b;
                que.push(P(ds[e.to], e.to));
            }
        }
    }
}

int main()
{
    ll m, s, t;
    cin >> N >> m >> s >> t;
    rep(i, m)
    {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        edge e;
        e.to = v;
        e.a = a;
        e.b = b;
        G[u].push_back(e);
        e.to = u;
        G[v].push_back(e);
    }
    dijkstrae(s);
    dijkstras(t);
    ll ans = INF;
    ll c = 1e15;
    vector<ll> res;
    for (int i = N; i > 0; i--)
    {
        ans = min(ans, de[i] + ds[i]);
        res.push_back(ans);
    }
    reverse(res.begin(), res.end());
    rep(i, res.size())
    {
        cout << c - res[i] << endl;
    }
}

Measured memory_bytes: 14540
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T>
T gcd(T n, T m){
    if (n>m) return gcd(m,n);
    else if(n==0) return m;
    else return gcd(m-n*(m/n), n);
}

int main(){
    int n, k;
    cin >> n >> k;
    int h[n];
    rep(i,n) cin >> h[i];
    int ans = 0;
    rep(i,n){
        if(h[i] >= k) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
v_even = [ele for i, ele in enumerate(v) if i%2==0]
v_odd  = [ele for i, ele in enumerate(v) if i%2==1]
counter_even = Counter(v_even).most_common(2)
counter_odd  = Counter(v_odd).most_common(2)

if counter_even[0][0] != counter_odd[0][0]:
    print(n - counter_even[0][1] - counter_odd[0][1])
else:
    if len(counter_even) > 1 and len(counter_odd) > 1:
        if counter_even[0][1] > counter_odd[0][1]:
            print(n - counter_even[0][1] - counter_odd[1][1])
        elif counter_even[0][1] < counter_odd[0][1]:
            print(n - counter_odd[0][1] - counter_even)
        else:
            if counter_even[1][1] > counter_odd[1][1]:
                print(n - counter_odd[0][1] - counter_even[1][1])
            else:
                print(n - counter_even[0][1] - counter_odd[1][1])

    elif len(counter_even) == 1 and len(counter_odd) > 1:
        print(int(n/2) - counter_odd[1][1])
    elif len(counter_even) > 1 and len(counter_odd) == 1:
        print(int(n/2) - counter_even[1][1])
    else:
        print(int(n/2))


Measured memory_bytes: 15972
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>

using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < n; i++)


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

    if (a==b && a!=c) {
        cout << "Yes" << endl;
    } else if (a==c && a!=b) {
        cout << "Yes" << endl;
    } else if (b==c && b!=a) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())

mod = 10 ** 9 + 7

mi = 0
ma = N
mii = 1
maa = N - 1
su = 0
for i in range(1,N+2):
    if i >= K:
        su += ma - mi + 1
        su %= mod
    mi += mii
    mii += 1
    ma += maa
    maa -= 1

print(su)


Measured memory_bytes: 64588
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n;
  cin >> n;
  string s;
  map<string, int> m;
  m["AC"] = 0;
  m["WA"] = 0;
  m["TLE"] = 0;
  m["RE"] = 0;
  REP(i, n) {
    cin >> s;
    m[s]++;
  }

  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;

  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
ll MOD = 1000000007;
string yes = "YES\n";
string no = "NO\n";
#define PI 3.1415926535 
 
 
int32_t main() {
    fastio;
    string s,t;
    cin>>s>>t;
    ll cnt = 0;
    for(ll i=0;i<s.size();i++) {
        if(s[i] != t[i]) cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll h, w, a, b;
  in2(h, w);
  in2(a, b);
  rep(i, h){
    if(i < b){
      rep(j, w){
        if(j < a)
          out(0);
        else
          out(1);
      }
    }
    else{
      rep(j, w){
        if(j < a)
          out(1);
        else
          out(0);
      }
    }
    memi;
  }
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    char s[100005];
    scanf("%s", s);
    int loc[100005] = {0};
    int len = strlen(s);
    int nowr = 0;
    for(int i = 0; i < len; ++i)
    {
        if(s[i] == 'R')
            nowr = i;
        if(s[i] == 'L')
            loc[i] = nowr;
    }
    int nowl = len - 1;
    for(int i = len-1; i >= 0; --i)
    {
        if(s[i] == 'L')
            nowl = i;
        if(s[i] == 'R')
            loc[i] = nowl;
    }
    int ans[100005] = {0};
    for(int i = 0; i < len; ++i)
    {
        if(s[i] == 'R')
        {
            if((loc[i] - i) % 2 == 0)
            {
                ans[loc[i]]++;
            }
            else
            {
                ans[loc[i]-1]++;
            }
        }
        if(s[i] == 'L')
        {
            if((i - loc[i]) % 2 == 0)
            {
                ans[loc[i]]++;
            }
            else
            {
                ans[loc[i]+1]++;
            }
        }
    }
    for(int i = 0; i < len; ++i)
    {
        printf("%d", ans[i]);
        if(i != len - 1)
            printf(" ");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
//    return *(int*)a - *(int*)b;
    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

long long  factorial(long long n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}

int main()
{
  int a ,b, c, d, e, X, Y;
  //long long  a, b, c, d, e, X, Y;
  //  double  c;
  int  A[200003]={};
//  long long  A[100003]={};
//  long long  B[100003]={};
  int  C[100003][11]={};

  int  flg=0;

//  long long  a, b, c, d, X, Y;
  char s[101][101]={};
  char t[101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p,q;
//  int flag=0;
//  int tmp=0;
  char tmp[101]={};
  long long min=10000000000;
//  long long min=100000001;
  int len=0;
  int l=0;
  int r=1000001;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  long long ans=1;
  int max=0;
  int addr=0;
  int ptn=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
//  scanf("%d%d", &a,&c);
//  cnt = strlen(t);
// printf("%d\n",a);
  scanf("%d", &X);
  for(i=0;i<X;i++){
    scanf("%d", &A[i]);
  }
  
  for(i=0;i<X-2;i++){
    if(A[i] > A[i+1]&&A[i+2]< A[i+1]) cnt++;      
    if(A[i] < A[i+1]&&A[i+2]> A[i+1]) cnt++;
  }
 printf("%d\n",cnt);
  

    
//    printf("%s %d %d\n", s[i],C[i][0],C[i][1]);
   // printf("%d\n", C[i][1]);
/*  for(i=0;i<addr;i++){
//  scanf("%lld%lld", &B[0][i],&B[1][i]);
//    ans=ans+A[i];
    printf("%lld ", A[i]);
  }
*/
//    printf("%d ", cnt);
   
//  ans=a*3;
//  ans=(ans+b)/2;
//  printf("%d\n", ans);

  
//  printf("%lf\n",ans);
  //  //  if(flag==0)   printf("TLE\n");
//    if(max < cnt - max)  printf("Yes\n");
//    else  printf("No\n");
  
return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    int an, bn, m;
    cin >> an >> bn >> m;
    int a[an], b[bn], mia=1000000, mib = 1000000;
    for (auto &ai:a) {
        cin >> ai;
        mia = min(ai, mia);
    }
    for (auto &bi:b) {
        cin >> bi;
        mib = min(bi, mib);
    }
    int ans = mia + mib;
    for (int i=0, x, y, c; i<m; i++) {
        cin >> x >> y >> c;
        x--; y--;
        ans = min(ans, a[x] + b[y] - c);
    }
    cout << ans << '\n';
    return 0;
}

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

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

    vector<ll> A(N);
    ll ans = 1;
    ll zerocnt = 0;

    for (ll i=0; i<N; i++) {
        cin >> A.at(i);
        if (A.at(i) == 0) {
            zerocnt++;
        }
    }

    if (zerocnt > 0) {
        cout << 0 << endl;
        return 0;
    }

    for (ll i=0; i<N; i++){
        if (A.at(i) <= 1000000000000000000/ans){
            ans *= A.at(i);
        }
        else {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 4036
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int i,s,x;
	x=0;
	for(i=0;i<10;i++){
		cin>>s;
		x=x+s;
	}
	cout<<x<<endl;
	
	return 0;
}


Measured memory_bytes: 3116
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair<int,string> P;

int main(){
  int total_pipes;
  while(~scanf("%d",&total_pipes)){
    if(total_pipes == 0) break;

    unsigned int sum = 0;
    for(int i=0;i<total_pipes;i++){
      int pipe;
      scanf("%d",&pipe);
      sum += pipe;
    }

    int total_joins = total_pipes - 1;

    vector<int> joins;
    for(int i=0;i<total_joins;i++){
      int join;
      scanf("%d",&join);
      sum += join;
      joins.push_back(join);
    }

    sort(joins.begin(),joins.end());
    unsigned int res = sum;
    for(int pipe_num=2,join_idx=0;pipe_num <= total_pipes; pipe_num++,join_idx++){
      sum -= joins[join_idx];
      res = max(sum * pipe_num,res);
    }
    printf("%u\n",res);
  }
}

Measured memory_bytes: 1576
# ABC123A - Five Antennas
lst = list(map(int, [input() for _ in range(5)]))
k = int(input())
answer = "Yay!"
count = 0

for i in range(4, 0, -1):
    count += 1
    for j in range(4 - count):
        if lst[i] - lst[j] > k:
            answer = ":("
            break
    break

print(answer)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	 public static void main(String argv[]) throws IOException {
	        InputStreamReader is = new InputStreamReader(System.in);
	        BufferedReader br = new BufferedReader(is);
	        String str;
	        String Array[]=new String[6];
	        double a,b,c,d,e,f,x,y;
	        while ((str = br.readLine()) != null) {
	            Array=str.split(" ");
	            a = Double.parseDouble(Array[0]);
	            b = Double.parseDouble(Array[1]);
	            c = Double.parseDouble(Array[2]);
	            d = Double.parseDouble(Array[3]);
	            e = Double.parseDouble(Array[4]);
	            f = Double.parseDouble(Array[5]);
	            y=(d*c -a*f)/(b*d- a*e);
	            x=(e*c -b*f)/(e*a - b*d);
	            if (x == 0) x=0.000;
	            if (y == 0) y=0.000;
	            System.out.printf("%.3f %.3f\n",x,y);
	        }
	    }

}

Measured memory_bytes: 24932
//#pragma GCC optimize("-O3")
/*
				C++
				encoding: UTF-8
				Last Modified: 16/Nov/19 05:30:19 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on


signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	int r;
	cin >> r;
	pr (r * r);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++) {
        for(int j = i + 1; j < s.size(); j++) {
            if(s[i] == 'C' && s[j] == 'F') {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    cout<<(n/2)*((n+1)/2)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

vector <vector <LL> >adj;
void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b){
    REP(i, N+1){
        vector<long long> l;
        adj.PB(l);
    }
    REP(i, M){
        adj[a[i]].PB(b[i]);
        adj[b[i]].PB(a[i]);
    }
    REP(i, N){
        cout<<adj[i+1].size()<<endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M);
    std::vector<long long> b(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, M, std::move(a), std::move(b));
    return 0;
}


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

using namespace std;

int main() {
  int n;
  string s;
  set<string> se;
  char t;
  cin >> n >> s;
  t = s.back();
  se.insert(s);
  for (int i = 1; i < n; ++i) {
    cin >> s;
    if (s[0] != t || se.count(s)) {
      puts("No");
      return 0;
    }
    t = s.back();
    se.insert(s);
  }
  puts("Yes");
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  while(1){
    string a;
    int ans=0,b=0,d=0;
    cin>>a;
    if(a[0]=='#')break;
    if(a.size()!=1){
      for(int i=0;i<a.size();i++){
	int c=a[i]-'a';
	if(c==24||c==20||(7<=c&&c<=15)){
	  b=1;
	}
	else b=0;
	if(i!=0){
	  if(d!=b){
	    ans++;
	    d=b;
	  }
	}else{
	  d=b;
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3164
#require "pry-byebug"
K,N = gets.split.map(&:to_i)
ary = gets.split.map(&:to_i)

dist_max = 0
ary_dist = []
idx_max_dist = -1
N.times do |n|
  idx_next = (n+1) % N
  dist = 0
  if ary[idx_next] < ary[n]
    dist = (ary[idx_next] + K) - ary[n]
  else
    dist = ary[idx_next] - ary[n]
  end
  #puts "n:#{n}, idx_next:#{idx_next}, dist:#{dist}"
  if dist_max < dist
    dist_max = dist
    idx_max_dist = n
  end
  ary_dist << dist
end
#puts "idx_max_dist:#{idx_max_dist}"
#p ary_dist
ary_dist.delete_at(idx_max_dist)
puts ary_dist.inject(:+)



Measured memory_bytes: 17028
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); i++)
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    string s;
    cin >> n >> s;
    if (n % 2 != 0) {
        cout << "No" << endl;
    } else {
        string t1, t2;
        for (int i = 0; i < n/2; i++) {
            t1 += s[i];
        }
        for (int j = n/2; j < n; j++) {
            t2 += s[j];
        }
        if (t1 == t2) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 256
Scanf.scanf "%d %d" @@ fun n m ->
  let lrs = Array.init m @@ fun _ -> Scanf.scanf " %d %d" @@ fun l r -> l, r in
  let f (l, r) (l1, r1) = max l l1, min r r1 in
  let l, r = Array.fold_left f lrs.(0) lrs in
  Printf.printf "%d\n" @@ max 0 @@ r - l + 1

Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5, OO=0x3f3f3f3f;
int h[N], dp[N], n, k;
int go(int idx)
{
    if (idx==n-1)
        return 0;
    if (dp[idx]!=-1)
        return dp[idx];
    dp[idx]=1e9;
    for (int i=1 ; i<=k ; i++)
        if (i+idx<n)
            dp[idx]=min(dp[idx], abs(h[idx]-h[idx+i])+go(idx+i));
    return dp[idx];
}
int main()
{
    cin >> n >> k;
    memset(dp, -1, sizeof dp);
    for (int i=0 ; i<n ; cin >> h[i++]);
    cout << go(0);
    return 0;
}



Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll K;
    cin >> K;
    
    auto check = [&](ll X){
        // Xを桁ごとのvectorに変換
        vector<int> vx;
        while(X > 0){
            vx.push_back(X%10);
            X/=10;
        }
        reverse(all(vx));
        //桁数
        int N = vx.size();
        // dp[i][smaller][0以外を一度でも取ったか][最後の数字]
        ll dp[N+1][2][2][10];
        rep(i,N+1)rep(j,2)rep(k,2)rep(l,10)dp[i][j][k][l] = 0;
        //dp[1]のみ特殊なのでここで初期化する
        dp[1][1][0][0] = 1;
        for(int i = 1;i < vx[0];i++) dp[1][1][1][i] = 1;
        dp[1][0][1][vx[0]] = 1;
        //dpの遷移
        for(int i = 1; i < N; i++){
            //0以外を取ってないところからの遷移(k = 0)
            dp[i+1][1][0][0] += dp[i][1][0][0];
            rep1(l,10)dp[i+1][1][1][l] += dp[i][1][0][0];

            //0を既に取っているところからの遷移(k = 1)
            rep(j,2)rep(l,10){
                int minl = max(0, l-1);
                int maxl = min(l+1, (j ? 9:vx[i]));
                for(int nxt = minl; nxt <= maxl; nxt++){
                    dp[i+1][j || nxt < vx[i]][1][nxt] +=  dp[i][j][1][l];
                }
            }
        }
        ll cnt = 0;
        rep(j,2)rep(l,10)cnt += dp[N][j][1][l];
        return cnt >= K;
    };

    ll ng = 0;
    ll ok = 1e18;
    while(ok - ng > 1){
        ll mid = (ok + ng) / 2;
        if(check(mid))ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}

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

int P;
int arr[MAX];
int poly[MAX];

inline int add(int a, int b)
{
	return (a + b) % P;
}

inline int prod(int a, int b)
{
	return a * b % P;
}

int main(void)
{
	cin >> P;
	arr[P] = 1;
	for (int i = 0; i < P; i++)
	{
		int val;
		cin >> val;
		if (!val) continue;
		poly[P - 1] = add(poly[P - 1], P - 1);
		arr[P - 1] = i;
		for (int j = P - 1; j > 1; j--)
		{
			poly[j - 1] = add(poly[j - 1], P - arr[j]);
			arr[j - 1] = prod(arr[j], i);
			arr[j] = 0;
		}
		poly[0] = add(poly[0], P - arr[1] + 1);
	}
	for (int i = 0; i < P; i++) cout << poly[i] << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    sc.close();
    int[] arr = new int[1];
    
    for(int i = 1; i < 10000000; i++) {
      if(i*8/100 == a && b == i*10/100) {
        arr[0] = i;
        break;
      }
    }
    
    if(arr[0] == 0) {
      System.out.println("-1"); 
    } else {
      System.out.println(arr[0]); 
    }
  }
}

Measured memory_bytes: 23252
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vvll vector<vll>
#define all(v) v.begin(),v.end()
#define itr(r,v) for(auto r=v.begin();r!=v.end();r++)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfr(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define ctime auto sttart = high_resolution_clock::now()
#define etime auto sttop = high_resolution_clock::now()
#define go_t ll testcases; cin>>testcases; for(ll caseno= 1 ;caseno <= testcases; caseno++)
#define ptime auto z1z = duration_cast<microseconds>(sttop-sttart); cout<<"\nTime taken : "<<z1z.count()<<" microseconds\n"
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';

using namespace std;
using namespace std::chrono;

const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
const ll maxN = 2e5 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

ll powerM(ll x, ll y, ll M = MOD) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	FIO
	ll n; cin >> n;
	ll a[n], b[n], c[n];
	FOR(i, n) cin >> a[i] >> b[i] >> c[i];
	ll dp[n][3] = {};
	dp[0][0] = a[0], dp[0][1] = b[0], dp[0][2] = c[0];
	for (ll i = 1; i < n; i++) {
		dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;
	return 0;
}


Measured memory_bytes: 8280
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String c = sc.next();
    String[] strAry = {"a", "i", "u", "e", "o"};
    String ans = "consonant";
    for(String s : strAry){
       if(s.equals(c)){
           ans = "vowel";
       } 
    }
     System.out.println(ans);
  }
}

Measured memory_bytes: 23124
#include<stdio.h>
int main()
{
	int a, b, d, r;
	double f;
	scanf("%d %d", &a, &b);
	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	printf("%d %d %.5f\n", d, r, f);
	return 0;
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;


int main(){
    string S,T;
    cin >> S >> T ;
    int s=S.size();
    int count=0;
    for(int i=0;i<s;i++){
        if (S.at(i)!=T.at(i)){
            count++;
        }
    }

    


    cout << count <<endl;

}

Measured memory_bytes: 3916
fun main(args: Array<String>) {
    fun readLineAndSplitBySpace() = readLine()!!.split(" ")

    val (N, K) = readLineAndSplitBySpace().map { it.toInt() }

    val sunuke = hashSetOf<String>()
    repeat(K) {
        readLine()!!
        readLineAndSplitBySpace().forEach { sunuke.add(it) }
    }

    println(N - sunuke.size)
}


Measured memory_bytes: 38728
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); }
    string S = "YES";
    bool judge = true;
    for (int i = 0; i < N; i++) {
        if(p.at(i) != i + 1) {
            if(judge == true) {
                judge = false;
                for (int j = 0; j < N; j++) {
                    if (p.at(j) == i + 1) { swap(p.at(i), p.at(j)); }
                }
            }
            else {
                S = "NO";
                break;
            }
        }
    }
    cout << S << endl;
}

Measured memory_bytes: 256