akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>

int main(void){
    int N, K, d[110] , A[110][110] ,S[110]={};
    int i, j , k=0 ;

        
    scanf("%d%d" ,&N, &K);
    for( i=1; i<=K ; i++ ){
        scanf("%d" ,&d[i]);
        
        for( j=1 ; j<= d[i] ; j++){
            scanf("%d" ,&A[i][j]);
            S[A[i][j]]=1;
        };
    };

    for( i=1 ; i<=N ; i++){
        if(S[i]==0){
            k++;
        };
    };

    printf("%d" ,k);

  return 0;
}


Measured memory_bytes: 1776
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(long long H, long long A){
  op((H+A-1)/A)
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
    scanf("%lld",&H);
    long long A;
    scanf("%lld",&A);
    solve(H, A);
    return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()

ans = [0] * (plst[-1] + 1)

for i in range(len(plst)):
    for j in range(plst[i], plst[-1]+1, plst[i]):
        ans[j] += 1
d = 0
for i in range(len(plst)):
    if ans[plst[i]]==1 and cnt[plst[i]]==1: d += 1
print(d)

Measured memory_bytes: 51088
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>

using namespace std;

long long a[200020];


int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int len = n - k;
	int j = 0;
	while (len--) {
		if (a[k] > a[j])
			printf("Yes\n");
		else
			printf("No\n");
		k++;
		j++;
	}
	return 0;
}

Measured memory_bytes: 4720
x , n = map(int,input().split())
numberbuffer = 0
diff = 100000

if n == 0:
    print(x)
else:
    
    p = list(map(int,input().split()))
    
    pinverse = []
    
    for i in range(max(p)*2 +2):
        if (i-max(p)) not in p:
            pinverse.append(i-max(p))
        
    for y in pinverse:
        
        if abs(x-y) < diff:
            diff = abs(x-y)
            numberbuffer = y
        
        if diff == abs(x-y):
            if numberbuffer > y:
                numberbuffer = y
    
    print(numberbuffer)

Measured memory_bytes: 63780
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000007
//0=48,A=65,a=97

int main() {
    ll n;cin >> n;
    ll t=n,m=1;
    while(t>=10){
        t /= 10;
        m++;
    }
    int nine=0;
    for(int i = 0; i < m; i++) {
        if(n%10==9){
            nine++;
        }
        if(i!=m-1) n /= 10;
    }

    if(nine==m) cout << m*9 << endl;
    else if(nine==m-1 && n != 9) cout << t+(m-1)*9 << endl;
    else cout << (m-1)*9+t-1 << endl;

    return 0;
}

Measured memory_bytes: 3600
H,W = map(int, input().split())
C = [[int(c) for c in input().split()] for _ in range(10)]
A = [[int(a) for a in input().split()] for _ in range(H)]

for i in range(10):
    for j in range(10):
        for k in range(10):
            C[j][k] = min(C[j][k], C[j][i] + C[i][k])
        
ans = 0
for i in range(H):
    for j in range(W):
        if A[i][j] != -1:
            ans += C[A[i][j]][1]
            
print(ans)

Measured memory_bytes: 40284
#include <iostream>
#include <string>
#include <utility>
#include <set>
#include <vector>
#include <queue>
using namespace std;
#define loop(i,n) for(int i=0;i<n;i++)

int main(){

    string s;
    cin>>s;
    cout<<(s.substr(0,4)+" "+s.substr(4,8))<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define cerr if(0) cerr

const int INF = 1e9 + 7;

vector <vector <bool> > f, used;
vector <vector <pi> > d[4];
pi dx[4] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0} };

void dijkstra(int stx, int sty, int step) {
    priority_queue <pair <pi, pi>, vector <pair <pi, pi> >, greater<pair <pi, pi> > > q; 
    loop(i, 4) {
        q.push({ { 0, step }, {stx, sty} });;
        d[i][stx][sty] = { 0, step };
    }
    while (!q.empty()) {
        auto v = q.top();
        q.pop();
        int x = v.S.F, y = v.S.S, cd = v.F.F, ck = v.F.S;
        if (used[x][y])
            continue;
        loop(i, 4) {
            int nx = x + dx[i].F, ny = y + dx[i].S;
            if (f[nx][ny])
                continue;
            pi add = (d[i][x][y].F > cd || d[i][x][y].S == step ? mkp(cd + 1, 1) : mkp(cd, d[i][x][y].S + 1));
            if (d[i][nx][ny] > add) {
                d[i][nx][ny] = add;
                q.push({ add, { nx, ny } });
            }
        }
    }
}

void solve() {
    int h, w, step;
    cin >> h >> w >> step;
    int stx, sty, fx, fy;
    cin >> stx >> sty >> fx >> fy;
    f.resize(h + 2);
    used.resize(h + 2);
    loop(i, 4)
        d[i].resize(h + 2);
    loop(i, h + 2) {
        f[i].resize(w + 2);
        used[i].resize(w + 2);
        loop(j, 4)
            d[j][i].resize(w + 2);
    }
    loop(i, h + 2)
        f[i][0] = f[i][w + 1] = 1;
    loop(i, w + 2)
        f[0][i] = f[h + 1][i] = 1;
    loop(i, h + 2)
        loop(j, w + 2)
            loop(k, 4)
                d[k][i][j] = {INF, INF};
    loop1(i, h) {
        loop1(j, w) {
            char c; cin >> c;
            f[i][j] = (c == '@');
        }
    }
    dijkstra(stx, sty, step);
    int ans = INF;
    loop(i, 4)
        ans = min(ans, d[i][fx][fy].F);
    cout << (ans == INF ? -1 : ans);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 97724
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class CReconciled {
public:
	void solve(istream& in, ostream& out) {
        ll n,m;
        in >> n >> m;
        ll ans = 1,MOD = 1e9 + 7;
        if(abs(n - m) > 1) out << 0 << endl;
        else{
            for(ll i = 1;i <= n;i++){
                ans *= i;
                ans %= MOD;
            }for(ll i = 1;i <= m;i++){
                ans *= i;
                ans %= MOD;
            }
            if(abs(n - m) == 1) out << ans << endl;
            else out << (ans * 2) % MOD << endl;
        }
	}
};

int main() {
	CReconciled solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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

template<typename flow_t>
struct FordFulkerson {
	struct edge{
		int to;
		flow_t cap;
		int rev;
		bool isrev;
		int idx;
	};

	vector<vector<edge> > graph;
	vector<int> used;
	const flow_t INF;
	int timestamp;

	FordFulkerson(int n) : INF(numeric_limits<flow_t>::max()), timestamp(0){
		graph.resize(n);
		used.assign(n, -1);
	}

	void add_edge(int from, int to, flow_t cap, int idx = -1){
		graph[from].emplace_back((edge){to, cap, (int)graph[to].size(), false, idx});
		graph[to].emplace_back((edge){from, 0, (int)graph[from].size()-1, true, idx});
	}
	flow_t dfs(int idx, const int t, flow_t flow){
		if(idx==t)return flow;
		used[idx] = timestamp;
		for(auto &e: graph[idx]){
			if(e.cap > 0 && used[e.to] != timestamp){
				flow_t d = dfs(e.to, t, min(flow, e.cap));
				if(d > 0){
					e.cap -= d;
					graph[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	flow_t max_flow(int s, int t){
		flow_t flow = 0;
		for(flow_t f;(f=dfs(s,t,INF))>0;timestamp++){
			flow += f;
		}
		return flow;
	}

	void output(){
		for(int i=0;i<graph.size();i++){
			for(auto &e: graph[i]){
				if(e.isrev)continue;
				auto &rev_e = graph[e.to][e.rev];
				cout << i << "->" << e.to << "(flow: " << rev_e.cap << "/" << e.cap + rev_e.cap << "(" << endl;
			}
		}
	}
};

struct union_find{
	int N;
	vector<int> parent;
	vector<int> siz;

	union_find(int N) : parent(N), siz(N, 1){
		for(int i = 0; i < N; i++) parent[i] = i;
	}

	int root(int x){
		if(parent[x] == x) return x;
		else return parent[x] = root(parent[x]);
	}

	void merge(int x, int y){
//		printf("merge(%d, %d)\n", x, y);
		x = root(x), y = root(y);
//		printf("test0.1\n");
		if(x == y) return;
//		printf("test0.2\n");
		if(siz[x] < siz[y]) swap(x, y);
//		printf("test0.3\n");
		parent[y] = x;
//		printf("test0.5\n");
		siz[x] += siz[y];
//		printf("test0.6\n");
		siz[y] = 0;
//		printf("test1\n");
	}

	bool are_same(int x, int y){
		return root(x) == root(y);
	}

	int size(int x){
		return siz[root(x)];
	}
};

int main(){
	int N, M, i;
	scanf("%d%d", &N, &M);
	vector<int> x(M), y(M);
	for(i = 0; i < M; i++){
		scanf("%d%d", &x[i], &y[i]);
		x[i]--;
		y[i]--;
	}
	FordFulkerson<int> g(2 * N + 2);
	for(i = 1; i <= N; i++){
		g.add_edge(0, i, 1);
	}
	for(i = N + 1; i <= 2 * N; i++){
		g.add_edge(i, 2 * N + 1, 1);
	}
	for(i = 0; i < M; i++){
		g.add_edge(1 + x[i], 1 + N + y[i], 1);
	}
	int ans1 = M - g.max_flow(0, 2 * N + 1);
//	printf("test5\n");

	int ans2 = 0;
	union_find uf(2 * N);
	for(i = 0; i < M; i++){
//		printf("i = %d\n", i);
		uf.merge(x[i], N + y[i]);
	}
//	printf("test6\n");
	for(i = 0; i < 2 * N; i++){
		if(uf.root(i) == i){
			if(uf.size(i) > 1){
				ans2++;
			}
		}
	}
	ans2 = M - ans2;
	printf("%d %d\n", ans1, ans2);
	return 0;
}


Measured memory_bytes: 3448
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <deque>
#include <set>
#include <unordered_map>
#include <complex>
#include <fstream>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
using ll = long long;
using ld = long double;
const int mxn = 85;
ll a[mxn];

void buy(int i, ll &money, ll &stock) {
	ll ex = money/a[i]; stock+=ex;
	money-=ex*a[i];
}

void sell(int i, ll &money, ll &stock) {
	money+=stock*a[i];
	stock = 0;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i];

	ll money = 1000, stock = 0;
	for(int i=1; i<=n; i++) {
		if(i==1 and i<n and a[i+1]>a[i]) buy(1, money, stock);
		else if(i==n) sell(n, money, stock);
		else if(a[i-1]<=a[i] and a[i]>=a[i+1]) sell(i, money, stock);
		else if(a[i-1]>=a[i] and a[i]<=a[i+1]) buy(i, money, stock);
		else continue;
	}	
	assert(!stock);

	cout << money << '\n';

	return 0;
}

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

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

using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  
  if(a<=c && c<=b){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
  
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    //Guidebook
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Pair> list = new ArrayList<>();
        for (int i = 1; i <= n; i++) {
            String name = sc.next();
            int score = sc.nextInt();
            Pair p = new Pair(name, score, i);
            list.add(p);
        }
        Collections.sort(list, new Comparator<Pair>() {
            @Override
            public int compare(Pair a, Pair b) {
                if (a.name.equals(b.name)) return b.score - a.score;
                else return a.name.compareTo(b.name);
            }
        });
        for (Pair p : list) System.out.println(p.index);
        sc.close();
    }

    static class Pair {
        String name;
        int score;
        int index;

        public Pair(String name, int score, int index) {
            this.name = name;
            this.score = score;
            this.index = index;
        }
    }
}


Measured memory_bytes: 21844
s = input()
n = len(s)

sr = s[::-1]

s2 = s[:int((n-1)/2)]
#print(s2)
s2r = s2[::-1]

s3 = s[int((n+3)/2)-1:n]
#print(s3)
s3r = s3[::-1]

if (s == sr) and (s2 == s2r) and (s3 == s3r):
  print('Yes')
else:
  print('No')

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

int main(){
    int n;
    int nums[202];

    // 標準入力
    cin >> n;

    for (int i = 0; i < n ; ++i ) {
        cin >> nums[i];
    }
    int cnt = 0;
    while (true) {
        bool existOdd = false;
        
        for (int i = 0; i < n ; ++i ) {
             
             if (nums[i] % 2 != 0) existOdd = true;
        }

        if (existOdd) break;

        for (int i = 0; i < n ; ++i ) {
             
             nums[i] /= 2;
        }

        ++cnt;

    }

    
    cout << cnt << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    long long ans;
    long long r=0,g=0,b=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R') r++;
        else if(s[i]=='G') g++;
        else if(s[i]=='B') b++;
    }
    
    ans=r*g*b;
    for(int i=0;i<n-2;i++){
        int len=1;  //间隔长度+1
        while(i+len+len<n){
            if(s[i]!=s[len+i] && s[len+i]!=s[len+len+i] && s[i]!=s[len+len+i])
                ans--;
            len++;
        }
    }

    cout<<ans;
    return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int p, q, r;
    cin >> p >> q >> r;
    cout << p + q + r - max({p, q, r}) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#define N 100005
using namespace std;

int n, m, q, b1[N], b2[N], b3[N], c[N], d[N];
vector<int> a[N];

void f(int p, int q, int r) {
	int i;
	if (q <= d[p]) return;
	d[p] = q;
	if (!c[p]) c[p] = r;
	for (i = 0; i < a[p].size(); i++) f(a[p][i], q - 1, r);
}

int main()
{
	int i, t1, t2;
	cin >> n >> m;
	memset(d, -1, sizeof(d));
	for (i = 0; i < m; i++) {
		scanf("%d %d", &t1, &t2);
		a[t1].push_back(t2);
		a[t2].push_back(t1);
	}
	cin >> q;
	for (i = 0; i < q; i++) scanf("%d %d %d", &b1[i], &b2[i], &b3[i]);
	for (i = q - 1; i >= 0; i--) {
		f(b1[i], b2[i], b3[i]);
	}
	for (i = 1; i <= n; i++) printf("%d\n", c[i]);
    return 0;
}

Measured memory_bytes: 8440
#include <bits/stdc++.h>
using namespace std;
int n,m,r,C[102][102];
int main() {
	scanf("%d %d",&n,&m);
	if(n==2) {
		if(m==0)printf("1\n1 2 ");
		else printf("-1");
		return 0;
	}
	if(n==3) {
		if(m==0)printf("3\n1 2\n2 3\n1 3");
		else if(m==1) printf("2\n1 2\n2 3");
		else printf("-1");
		return 0;
	}
	if(n==4) {
		if(m==0)printf("6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4");
		else if(m==1) printf("5\n1 2\n1 3\n1 4\n2 3\n2 4");
		else if(m==2) printf("3\n1 2\n2 3\n3 4");
		else if(m==3) printf("3\n1 2\n1 3\n1 4");
		else printf("-1");
		return 0;
	}
	r=(n-2)*(n-1)/2;
	if(m>r) {
		printf("-1");
		return 0;
	}
	r=(n-1)*n/2;
	for(int i=1; i<=n; i++)
		for(int j=i+1; j<=n; j++)
			C[i][j]=C[j][i]=1;
	int i=2;
	while(m>n-i) {
		m-=n-i;
		for(int j=i+1; j<=n; j++)
			C[i][j]=C[j][i]=0,r--;
		i++;
	}
	for(int j=1; j<=m; j++)
		C[i][j+i]=C[j+i][i]=0,r--;
	printf("%d\n",r);
	for(int i=1; i<=n; i++)
		for(int j=i+1; j<=n; j++)
			if(C[i][j])printf("%d %d\n",i,j);
	return 0;
}

Measured memory_bytes: 256
#line 1 "/workspaces/compro/lib/template.hpp"


#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>

#ifndef IO_VECTOR
#define IO_VECTOR

template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}

template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}

#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes, T no) { cout << (val ? yes : no) << "\n"; }

void say(bool val, string yes = "Yes", string no = "No") { say<string>(val, yes, no); }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}

// C++ 17に完全移行したら消す
// 最大公約数を求める
template <class T> T gcd(T n, T m) { return n ? gcd(m % n, n) : m; }

// 最小公倍数を求める
template <class T> T lcm(T n, T m) {
  int g = gcd(n, m);
  return n * m / g;
}

// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}


#line 2 "abc173_c.cpp"

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

  int h, w, k;
  cin >> h >> w >> k;

  vector<vector<int>> grid(h, vi(w, 0));
  REP(i, h) {
    string s;
    cin >> s;
    REP(j, w) {
      if (s[j] == '#') {
        grid[i][j] = 1;
      }
    }
  }

  int bh = (1 << h);
  int bw = (1 << w);
  int ans = 0;
  REP(si, bh) {
    REP(sj, bw) {
      vector<vector<bool>> used(h, vector<bool>(w, true));
      REP(i, h) {
        if ((si >> i) % 2 == 1) {
          REP(j, w) { used[i][j] = false; }
        }
      }
      REP(j, w) {
        if ((sj >> j) % 2 == 1) {
          REP(i, h) { used[i][j] = false; }
        }
      }

      int cnt = 0;
      REP(i, h) {
        REP(j, w) {
          if (used[i][j] && grid[i][j] == 1) {
            cnt++;
          }
        }
      }
      if (cnt == k) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int S;
  cin >> S;
  int L = S/100;
  int R = S%100;
  if(L>=1&&L<=12){
    if(R>=1&&R<=12)
      cout << "AMBIGUOUS" << endl;
    else 
        cout << "MMYY" << endl;  
  }else{
     if(R>=1&&R<=12) 
     cout << "YYMM" << endl;  
     else 
     cout << "NA" << endl;
  }
   
}

Measured memory_bytes: 256
import kotlin.math.max

fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main() {
    val (n, p) = intList()
    val a = intList()
    val o = a.count { it % 2 == 1 }
    val e = n - o
    var ec = 1L
    repeat(e) {
        ec *= 2
    }
    var oc = 0L
    var i = 0
    if (p == 0) {
        i = 2
        while (i <= o) {
            oc += nCr(o, i)
            i += 2
        }
        if (o > 0) {
            oc++
        }
        val c = max(1, oc) * ec
        println(c.toString())
    } else {
        i = 1
        while (i <= o) {
            oc += nCr(o, i)
            i += 2
        }
        val c = oc * ec
        println(c.toString())
    }
}

fun nCr(n: Int, r: Int): Long {
    var rr = r
    if (n - r < r) {
        rr = n - r
    }
    val nf = n.downTo(n - rr + 1).fold(1L) { a, b -> a * b }
    val rf = rr.downTo(2).fold(1L) { a, b -> a * b }
    return nf / rf
}

Measured memory_bytes: 36312
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
    static int n;
    static int m;
    static int l;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        l = sc.nextInt();
        long[][] vec1 = new long[n][m];
        long[][] vec2 = new long[m][l];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                vec1[i][j]=sc.nextInt();
            }
        }
        for(int i=0;i<m;i++){
            for(int j=0;j<l;j++){
                vec2[i][j]=sc.nextInt();
            }
        }
        long[][] ans = vecMul(vec1,vec2);
        prlong(ans);
    }
    static void prlong(long[][] ans) {
        for(int i=0;i<ans.length;i++){
            for(int j=0;j<ans[i].length;j++){
                System.out.print(ans[i][j]);
                if(j!=ans[i].length-1)
                System.out.print(" ");
            }
            System.out.println();
        }
    }
    static long[][] vecMul(long[][] vec1,long[][] vec2) {
        long[][] ans = new long[n][l];
        long sum=0;
        //かける回数はn*lの要素数に等しい
        for(int i=0;i<n;i++){
            //完成する列 l までかける,これで出力の1行が完成する
            for(int j=0;j<l;j++){
                //vec2の行をかける
                for(int k=0;k<vec2.length;k++) {
                    sum += vec1[i][k] * vec2[k][j];
                }
                ans[i][j] = sum;
                sum=0;
            }
        }
        return ans;
    }
}

Measured memory_bytes: 45736
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  vector<int> a(3);
  for (auto &i : a)
    cin >> i;
  sort(a.begin(), a.end());
  if (a[0] + a[1] == a[2])
    cout << "Yes\n";
  else 
    cout << "No\n";
  return 0;
}
   

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func digitSum(n int) int {
	res := 0
	for n > 0 {
		res += n % 10
		n /= 10
	}

	return res
}

func main() {
	sc.Split(bufio.ScanWords)

	N, A, B := nextInt(), nextInt(), nextInt()

	sum := 0
	for i := 1; i <= N; i++ {
		ds := digitSum(i)
		if A <= ds && ds <= B {
			sum += i
		}
	}

	fmt.Println(sum)
}


Measured memory_bytes: 640
def calculate(a, b):
    if a < b :
        a, b = b, a
    
    while b > 0:
        a, b = b, a%b

    return a

N = int(input())
A_list = list(map(int, input().split()))
gcd_num = A_list[0]
for i in range(1, N):
    gcd_num = calculate(gcd_num, A_list[i])
print(gcd_num)

Measured memory_bytes: 14252
loop {
	n, s0 = gets.split.map &:to_i
	break if n == 0
	s = s0
	a = [0] * n
	i = 0
	
	loop {
		k = s / n
		a.map!{|x| x + k}
		(s % n).times{
			a[i] += 1
			i = (i+1)%n
		}
		break if a[(i-1)%n] == s0
		i = (i+1)%n until a[i] > 0
		s = a[i]
		a[i] = 0
		i = (i+1)%n
	}
	p (i-1)%n
}

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n) cin >> s[i];
  
  set<string> ans;
  rep(i,n) ans.insert(s[i]);
  
  int anss=ans.size();
  cout << anss << endl;
}

Measured memory_bytes: 25080
#include <bits/stdc++.h>
using namespace std;
long long s,i,h,a[200001],k;
int main ()
{
	cin>>h>>k;
	for(i=1;i<=h;i++)
	cin>>a[i];
	
	sort(a+1,a+h+1);
	
	for(i=1;i<=h-k;i++)
	s+=a[i];
	
	cout<<s;
	

}



Measured memory_bytes: 1792
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()
S = deque(S)
Q = INT()
flag = 1  # 1で正順
for _ in range(Q):
	q = input().split()
	if len(q) == 1:  # 前後入れ替え
		flag *= -1
	else:  # 先頭 or 末尾に追加
		_, F, C = q
		if F == "1" and flag == 1 or F == "2" and flag == -1:
			S.appendleft(C)
		else:
			S.append(C)
ans = "".join(S)
if flag == -1:
	ans = ans[::-1]
print(ans)


Measured memory_bytes: 10564
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int a[12][12];
const int INF = 1001001001;

int main(){
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  for(int i = 0; i < n; i++){
    cin >> c[i];
    for(int j = 0; j < m; j++) cin >> a[i][j];
  }

  int ans = INF;
  // 買う買わないを01（買うを1、買わないを0)として列挙する(bit探索)
  for (int s = 0; s < (1<<n); s++) { // bit探索
    int cost = 0;
    vector<int> d(m);
    for (int i = 0; i < n; i++) {
      if(s & (1<<i)){ // sの中でiがあるものを列挙する
          cost += c[i];
          for (int j = 0; j < m; j++) {
              d[j] += a[i][j];
          }
          bool ok = true;
          for (int j = 0; j < m; j++) {
              if(d[j] < x ) ok = false;
          }
          if(ok) ans = min(ans, cost);
      }
    }
  }
  if(ans == INF) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// auto mod int
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination mod prime
// mintが必要
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};



int main(){
    int n,k;
    cin >> n >> k;
    vector<ll>a(n);
    rep(i,n){
        cin >> a[i];
    }
    mint M=0,m=0;
    combination c(n);
    sort(a.begin(),a.end());
    rep(i,n-k+1){
        m+=c(n-i-1,k-1)*a[i];
    }
    reverse(a.begin(),a.end());
    rep(i,n-k+1){
        M+=c(n-i-1,k-1)*a[i];
    }
    mint ans = M-m;
    cout << ans.x << endl;
    
    return 0;
}


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

int main() {
  int K = 0,m = 0;
  string A;
  cin >> K >> A;
  m = A.size();
  if(m <= K){
    cout << A;
    return 0;
  }
  rep(i,K){
    cout << A.at(i);
  }
  cout << "...";
}

Measured memory_bytes: 3608
#include <iostream>
using namespace std;
 
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if ( ((a == 5 && b == 5) && c == 7) ||
         ((b == 5 && c == 5) && a == 7) ||
         ((c == 5 && a == 5) && b == 7) )
         cout << "YES" << endl;
    else
         cout << "NO" << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=50001,INF=1<<30;

int main(){

    int N,W;cin>>N>>W;
    vector<int> v(N),w(N);
    vector<vector<int>> dp(N+1,vector<int>(W+1,0));
    for(int i=0;i<N;i++){
        cin>>v[i]>>w[i];
    }
    
    for(int k=0;k<N;k++){
        for(int i=0;i<=W;i++){
            dp[k+1][i]=max(dp[k+1][i],dp[k][i]);
            if(i+w[k]>W) continue;
            dp[k+1][i+w[k]]=max(dp[k+1][i+w[k]],dp[k][i]+v[k]);
        }
    }
    
    int ans=0;
    
    for(int i=0;i<=W;i++){
        ans=max(ans,dp[N][i]);
    }
    
    cout<<ans<<endl;
}




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

int main(){
  int a,b;
  cin>>a>>b;
  int vec[a];
  for(int i=0;i<a;i++){
    cin>>vec[i];
  }
  sort(vec,vec+a);
  int ans=0;
  for(int i=0;i<b;i++){
    ans+=vec[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3576
import java.util.HashSet;
import java.util.Scanner;

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

    while (in.hasNext()) {
      HashSet<String> said = new HashSet<String>();
      int N = in.nextInt();
      String prev = in.next();
      boolean isShiritoriRule = true;

      --N;
      said.add(prev);
      while (N-- > 0){
        String curr = in.next();

        if (said.contains(curr)) {
          isShiritoriRule = false;
        }

        if (prev.charAt(prev.length() - 1) != curr.charAt(0)) {
          isShiritoriRule = false;
        }
        
        said.add(curr);
        prev = curr;
      }

      if (isShiritoriRule) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}

Measured memory_bytes: 21972
n, k = list(map(int, input().split()))
s = input()
now = 1
cnt = 0
Nums = []
for i in range(len(s)):
    if s[i] == str(now):
        cnt += 1
    else:
        Nums.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    Nums.append(cnt)
if len(Nums) % 2 == 0:
    Nums.append(0)

ans = 0
Add = 2 * k + 1

left = 0
right = 0
tmp = 0

for i in range(len(Nums))[::2]:
    Nextleft = i
    Nextright = min(i + Add, len(Nums))

    while Nextleft > left:
        tmp -= Nums[left]
        left += 1

    while Nextright > right:
        tmp += Nums[right]
        right += 1

    ans = max(tmp, ans)
print(ans)

Measured memory_bytes: 4212
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
ll x[1000];
ll y[1000];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    int m = (abs(x[0]) + abs(y[0])) % 2;
    for (int i = 0; i < n; i++)
    {
        if ((abs(x[i]) + abs(y[i])) % 2 != m)
        {
            cout << -1 << "\n";
            return 0;
        }
    }
    ll pow2[31];
    for (int i = 0; i < 31; i++)
    {
        pow2[i] = pow(2, i);
    }
    if(m==1)
    cout << 31 << "\n";
    else
    cout << 32<< "\n";
    for (int i = 30; i >= 0; i--)
    {
        cout << pow2[i] << "\n";
    }
    if(m==0){
        cout<<1<<"\n";
    }
    for (int i = 0; i < n; i++)
    {
        if(m==0)
        {
            x[i]--;
        }
        for (int j = 30; j >= 0; j--)
        {
            
                //cout<<x[i]<<" "<<y[i]<<"\n";
            
            if(m==0&&j==0){
                cout<<"R";
            }
            if (abs(x[i]) - abs(y[i]) >= 0)
            {
                if (x[i] >= 0)
                {
                    cout << 'R';
                    x[i] -= pow2[j];
                }
                else
                {
                    cout << 'L';
                    x[i] += pow2[j];
                }
            }
            else
            {
                if (y[i] >= 0)
                {
                    cout << 'U';
                    y[i] -= pow2[j];
                }
                else
                {
                    cout << 'D';
                    y[i] += pow2[j];
                }
            }
        }
        cout << "\n";
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include <iostream>
#include <cstdlib>
using namespace std;
int v[100005];
int main() {
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&v[i]);
        ans+=abs(v[i]-v[i-1]);
    }
    ans+=abs(v[n]);
    for(int i=1;i<=n;i++){
        cout<<ans-abs(v[i]-v[i-1])-abs(v[i+1]-v[i])+abs(v[i-1]-v[i+1])<<endl;
    }
    return 0;
}


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

int n,a[200010],l,r,mid,ans,p[6000010],pn,v[6000010];
bool bo;

bool check(int mid)
{
	p[pn=0]=0;
	for (int i=2; i<=n; i++)
		if (a[i]<=a[i-1])
		{
			while (p[pn]>a[i]) pn--;
			if (p[pn]==a[i])
			{
				v[pn]++;
				int nw=p[pn],nwp=pn;
				while (v[nwp]>mid)
				{
					v[nwp--]=1,nw--;
					if (!nw) return 0;
					if (p[nwp]==nw) v[nwp]++;
					else
					{
						nwp++;
						for (int j=pn; j>=nwp; j--) p[j+1]=p[j],v[j+1]=v[j];
						v[nwp]=2,p[nwp]=nw,pn++;
						break;
					}
				}
			} else p[++pn]=a[i],v[pn]=2;
		}
	return 1;
}

int main()
{
	scanf("%d",&n),bo=1,a[0]=0;
	for (int i=1; i<=n; i++) scanf("%d",&a[i]),bo&=(a[i-1]<a[i]);
	if (bo) return puts("1"),0;
	l=2,r=n;
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid)) r=mid-1,ans=mid; else l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4864
#include<iostream>
#include<cstring>

using namespace std;

const int N(5009);

int n, m, cnt, ans;
char a[N], b[N], c[N];
int f[N][N];

void print(int i, int j)
{
	while (i >= 0 && j>= 0)
	{
		if (a[i] == b[j])
		{
			c[cnt++] = a[i];
			i--;j--;
		}
		else if (f[i][j] == f[i][j - 1])
		{
			j--;
		}
		else
		{
			i--;
		}
	}
}
int main()
{
	scanf("%s%s", a, b);
	n = strlen(a);
	m = strlen(b);
	for (int i=0;i<n;i++)
	{
		if (a[i] == b[0]) f[i][0] = 1;
		else f[i][0] = f[max(i - 1, 0)][0];
	}
	for (int j=0;j<m;j++)
	{
		if (a[0] == b[j]) f[0][j] = 1;
		else f[0][j] = f[0][max(0, j-1)];
	}
	for (int i=1;i<n;i++)
	{
		for (int j=1;j<m;j++)
		{
			if (a[i] == b[j])
			{
				f[i][j] = f[i - 1][j - 1] + 1;
			}
			else
			{
				f[i][j] = max(f[i - 1][j], f[i][j - 1]);
			}
		}
	}
	print(n - 1, m - 1);
	if (cnt == 0) cout<<' ';
	else
	{
		for (int i=cnt-1;i>=0;i--)
		{
			cout<<c[i];
		}
	}
	return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
#define endl '\n'

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	//#endif
	int a,b,c;
	cin>>a>>b>>c;
	cout<<(a+b+c >= 22 ? "bust":"win")<<endl;
	return 0;
}

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

int main(){ 
    int N,K;
    int d[200100];
    cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> d[i];

    vector<int> num(200100, 0);  // バケット
    for (int i = 0; i < N; ++i) {
        num.at(d[i])++;
    }
    sort (num.begin(), num.end());
    reverse (num.begin(), num.end());
    int ans = 0;
    for  (int i = K; num.at(i) != 0; i++){
      ans += num.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
const bool unsyncedio=std::ios::sync_with_stdio(false);
using namespace std;
typedef unsigned int uint;
typedef long long ll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll (i)=0; (i)<(n); (i)++)

int main() {
    int n;
    cin>>n;
    vector<ll> a(n);
    ll cneg=0;
    ll c0=0;
    ll minabs=1000000001;
    fori(n) {
        cin>>a[i];
        if(a[i]==0)
            c0++;
        else if(a[i]<0)
            cneg++;
        minabs=min(minabs, abs(a[i]));
    }
    ll sub=0;
    if(c0==0 && cneg%2==1)
        sub=minabs;

    ll ans=0;
    fori(n)
        ans+=abs(a[i]);
    ans-=(2*sub);

    cout<<ans<<endl;
}



Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define Max(_A,_B) (_A>_B?_A:_B)
#define Min(_A,_B) (_A<_B?_A:_B)
#define Abs(_A) ((_A)?(_A):(-(_A))
#define INF 0x3f3f3f3f
#define MOD 1000000007
/*
f[i][j][l]表示，到了第i行第j列，用了l根棍子的时候，可以有的方案数。
那么，下面有两种转移方法。
如果j不是1，那么向左向右都可以。
否则只能向右。
然后，因为只能向下跑，所以只考虑向下转移的情况。
同时，不能平行跑。 
显然，f[i][1][0]=1;
于是可以用刷表法得出。
*/
//w 棍子，k 列数。 
long long h,w,k;
long long ans=0;
long long f[105][10];
long long fib[1005];
//Y取X的情况。 
void init(){
    scanf("%lld%lld%lld",&h,&w,&k);
    memset(f,0,sizeof(f));
    fib[1]=fib[2]=1;
    for(int i=3;i<=1000;++i){
        fib[i]=(fib[i-1]+fib[i-2])%MOD;
    }
    f[0][1]=1;
    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j){
            if(j>1){
                f[i][j]=(f[i][j]+(f[i-1][j-1]*fib[w-j+1]*fib[j-1])%MOD)%MOD;
            }
            if(j<w){
                f[i][j]=(f[i][j]+(f[i-1][j+1]*fib[w-j]*fib[j])%MOD)%MOD;
            }
            f[i][j]=(f[i][j]+(f[i-1][j]*fib[j]*fib[w-j+1])%MOD)%MOD;
        }
    }
    printf("%lld",f[h][k]);
}
int main(){
	init();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

LL labs(LL x){
    if(x>0){
        return x;
    }else{
        return x*(-1);
    }
}

int main(){
    LL x;
    LL k;
    LL d;
    cin >> x >> k >> d;
    LL res;
    LL ans=0;
    if(labs(x)/d>k){
        if(x>0){
            ans=x-d*k;
        }else{
            ans=x+d*k;
        }
    }else{
        res=k-labs(x)/d;
        if(x>0){
            ans=x-d*(labs(x)/d);
        }else{
            ans=x+d*(labs(x)/d);
        }
        if(res%2==1){
            if(x>0){
                ans=ans-d;
            }else{
                ans=ans+d;
            }
        }
    }
    ans=labs(ans);

    cout << ans << endl; 

    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)
#define drp(i,st,ed) for (int i=st;i>=ed;--i)

const int MOD=1e9+7;
const int N=2005;

int f[N][N],s[N][N];

int ksm(int x,int dep) {
	int res=1;
	for (dep=std:: max(dep,0);dep;dep>>=1,x=1LL*x*x%MOD) {
		(dep&1)?(res=1LL*res*x%MOD):0;
	}
	return res;
}

int main(void) {
	int n,k; scanf("%d%d",&n,&k);
	if (n==k) {
	}
	f[0][n+1]=1;
	drp(j,n+1,1) {
		s[0][j]=s[0][j+1]+f[0][j];
		(s[0][j]>=MOD)?(s[0][j]-=MOD):0;
	}
	rep(i,1,k) {
		rep(j,1,n-i+1) f[i][j]=s[i-1][j];
		drp(j,n+1,1) {
			s[i][j]=s[i][j+1]+f[i][j];
			(s[i][j]>=MOD)?(s[i][j]-=MOD):0;
		}
	}
	int ans=f[k][1]-f[k-1][1];
	(ans<0)?(ans+=MOD):0;
	ans=1LL*ans*ksm(2,n-k-1)%MOD;
	printf("%d\n", ans);
	return 0;
}

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

class dice {
private :
    map<string, int> face_num;
public :
    dice(map<string, int> &face_num) {
        this->face_num = face_num;
    }

    void roll(const char &direction) {
        if (direction == 'E') {
            swap(face_num["top"], face_num["left"]);
            swap(face_num["right"], face_num["left"]);
            swap(face_num["bottom"], face_num["left"]);
        }
        else if (direction == 'N') {
            swap(face_num["front"], face_num["bottom"]);
            swap(face_num["top"], face_num["bottom"]);
            swap(face_num["back"], face_num["bottom"]);
        }
        else if (direction == 'S') {
            swap(face_num["top"], face_num["back"]);
            swap(face_num["front"], face_num["back"]);
            swap(face_num["bottom"], face_num["back"]);
        }
        else if (direction == 'W') {
            swap(face_num["top"], face_num["right"]);
            swap(face_num["left"], face_num["right"]);
            swap(face_num["bottom"], face_num["right"]);
        }
        else
            cout << "plz input direction" << '\n';
    }
    
    int show_face_num(const string &position) {
        return face_num[position];
    }
};

int main()
{
    map<string, int> num;
    cin >> num["top"] >> num["front"] >> num["right"] >> num["left"] >> num["back"] >> num["bottom"];
    string s;
    cin >> s;
    
    // for (auto x : num) {
    //     cout << x.first << " " << x.second << '\n';
    // }
    dice d = dice(num);
    for(int i = 0; i < s.size(); i++)
        d.roll(s[i]);
    
    cout << d.show_face_num("top") << '\n';
  
    return 0;
}


Measured memory_bytes: 3236
#!/usr/bin/env python3
#ABC73 C

from collections import Counter
n = int(input())
a = [int(input()) for _ in range(n)]

a = Counter(a)
a = list(a.items())

ans = 0
for i,j in a:
    if j % 2 == 0:
        continue
    else:
        ans += 1

print(ans)


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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
	F_ORC(__VA_ARGS__) \
	(__VA_ARGS__)

#define E_ACH2(x, a) for (auto &x : a)
#define E_ACH3(x, y, a) for (auto &[x, y] : a)
#define E_ACH4(x, y, z, a) for (auto &[x, y, z] : a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...)       \
	E_ACHC(__VA_ARGS__) \
	(__VA_ARGS__)

template <typename A, typename B>
inline void chmin(A &a, B b)
{
	if (a > b)
		a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b)
{
	if (a < b)
		a = b;
}

int main()
{
	fast;
	int n;
	cin >> n;
	vi a(n);
	FOR(n)
		cin >> a[i];
	int ans = 1e9 + 5;
	for (int i = 1; i <= 100; i++)
	{
		int sum = 0;
		FOR(j, n)
		sum += (a[j] - i) * (a[j] - i);
		chmin(ans, sum);
	}
	cout << ans;
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    }

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



Measured memory_bytes: 39996
#include<stdio.h>
#include<iostream>
#define re register
#define ll long long
using namespace std;
int n,x[110],y[110],h[110];
int main(){
  scanf("%d",&n);
  for(re int i=1;i<=n;i++)scanf("%d%d%d",&x[i],&y[i],&h[i]);
  for(re ll i=0;i<=100;i++)
    for(re ll j=0;j<=100;j++){
      ll l=0,r=2e9;
      for(re ll k=1;k<=n;k++)
	if(h[k]==0)r=min(r,abs(i-x[k])+abs(j-y[k]));
	else l=max(l,h[k]+abs(i-x[k])+abs(j-y[k])),r=min(r,h[k]+abs(i-x[k])+abs(j-y[k]));
      if(l<=r){
	printf("%lld %lld %lld\n",i,j,r);return 0;
      }
    }
  
  return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ordered_set tree<ll int, null_type,less<ll int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m,n;
    	char c;
    	cin>>c;
    	c++;
    	cout<<c;
    }
    return 0;
}

Measured memory_bytes: 256