akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 1003;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1000000007;

int n, m, lst[MAXN];
bool vis[MAXN];
vector<int> edge[MAXN];


vector<int> ans;

void solve (int src) {
    memset(vis, 0, sizeof(bool) * (n+1));
    vis[src] = true;
    vector<int> que = {src};
    int ft = 0;


    while (ft < SZ(que)) {
        int cur = que[ft++];
        for (auto v : edge[cur]) {
            if (!vis[v]) {
                lst[v] = cur;
                que.emplace_back(v);
                vis[v] = true;
            } else if (v == src) {
                debug("test");
                vector<int> cycle = {src};
                while (cur != src) {
                    cycle.emplace_back(cur);
                    cur = lst[cur];
                }
                if (ans.empty() || SZ(cycle) < SZ(ans)) {
                    ans = cycle;
                }
                return;
            }
        }
    }
}
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> n >> m;
    REP (i, m) {
        int f, t;
        cin >> f >> t;
        edge[f].emplace_back(t);
    }

    REP1 (i, n) {
        debug(i);
        solve(i);
    }

    if (ans.empty()) {
        cout << -1 << endl;
    } else {
        cout << SZ(ans) << endl;
        for (auto v : ans) {
            cout << v << endl;
        }
    }
    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N,A,B;
  cin>>N>>A>>B;
  ll p=N/(A+B);
  N -= (A+B)*p;
  ll ans = A*p + min(N, A);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
using namespace std;
string s;
int a[100000];
int ans[100000];
int main()
{
    cin>>s;
    int N=s.length();
    int count_r=0,count_l=0;
    int pos_r;
    for(int i=0;i<N;){
        while(s.at(i)=='R'){
            ++count_r;++i;
        }
        pos_r=i-1;
        while(i<N&&s.at(i)=='L'){
            ++count_l;++i;
        }
        ans[pos_r]=(count_r+count_l)/2;
        ans[pos_r+1]=count_r+count_l-ans[pos_r];
        if(count_r%2!=0)swap(ans[pos_r],ans[pos_r+1]);
        count_r=0;count_l=0;
    }
    for(int i=0;i<N;++i)cout<<ans[i]<<' ';
    return 0;
}

Measured memory_bytes: 4144
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
#define REP(i,n) for(long long (i)=0;(i)<(long long)(n);(i)++)
#define RREP(i,n) for(long long (i)=(long long)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 
int main() {

    int N; cin >> N;
    vector<ll> D(N);
    REP(i,N) cin >> D[i];

    int M; cin >> M;
    vector<ll> T(M);
    REP(i,M) cin >> T[i];

    map<ll,ll> cnt1;
    map<ll,ll> cnt2;

    REP(i,N) cnt1[D[i]]++;
    REP(i,M) cnt2[T[i]]++;

    for (auto itr = cnt2.begin(); itr != cnt2.end(); itr++) {
        if (itr -> second > cnt1[itr -> first]) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}

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

using namespace std;


constexpr long long INF = 1e18;

int main() {
    long long ans = 1;
    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    for(int i = 0; i < n; i++) {
        if(a[i] == 0) {
            cout << 0 << "\n";
            return 0;
        } else if(a[i] <= INF / ans) {
            ans *= a[i];
        } else {
            cout << -1 << "\n";
            return 0;
        }
        
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4056
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n, k, a[100];
int main() {
  cin >> n >> k;

  i64 ians = 0;
  double ans = 0;
  for (i64 i = n; i > 0; --i) {
    i64 c = 0, x = i;
    while (x < k) {
      x *= 2;
      c++;
    }
    a[c]++;
  }

  vector<double> v;
  for (i64 i = 29; i >= 0; --i) {
    i64 x = 1;
    for (i64 j = 0; j < i; ++j) x *= 2;
    v.push_back(double(a[i]) / (n * x));
  }
  sort(begin(v), end(v));

  for (double x : v) ans += x;

  printf("%.12lf\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }


int main(){
    long long N, X, D;
    cin >> N >> X >> D;
    if(D == 0){
        if(X != 0) cout << N+1 << endl;
        else cout << 1 << endl;
        return 0;
    }
    if(D < 0){
        D = -D;
        X = -X;
    }
    map<long long, vector<pair<long long, long long>>> mp;
    for(long long i=0; i<=N; i++){
        long long md;
        if(X >= 0) md = (i*X) % D;
        else{
            long long tmp = N*(-X) / D + 100;
            md = (i*X+tmp*D) % D;
        }
        long long a = (i*X-md+i*(i-1)/2*D) / D;
        long long b = (i*X-md+i*(2*N-2-(i-1))/2*D) / D;
        mp[md].push_back(make_pair(a, b + 1));
    }
    long long ans = 0;
    for(auto x : mp){
        auto vec = x.second;
        sort(vec.begin(), vec.end());
        long long cur = vec[0].first;
        for(auto z : vec){
            cur = max(cur, z.first);
            ans += max(0LL, z.second - cur);
            cur = max(cur, z.second);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  string S; cin >> S;
  
  bool daydream=true;
  int len;
  while(daydream){
    len=S.size();
    if(len==0){
      daydream=false;
    }else if(S.substr(len-5)=="dream"){
      S=S.substr(0,len-5);
    }else if(S.substr(len-5)=="erase"){
      S=S.substr(0,len-5);
    }else if(S.substr(len-6)=="eraser"){
      S=S.substr(0,len-6);
    }else if(S.substr(len-7)=="dreamer"){
      S=S.substr(0,len-7);
    }else{
      daydream=false;
    }
  }
  
  cout << (len==0?"YES":"NO") << endl;
}


Measured memory_bytes: 512
'use strict'
function Main(input){
  input=input.split(/\n/);
  var N=input.shift()-0;
  var S=input.join('').trim().replace(/\s+/,'').split('');
  var W=0;
  for(let i=0;i<N;i++) if(S[i]==='.') W++;
  var a=[W];
  for(let i=0;i<N;i++){
    let d=(S[i]==='.'?-1:1);
    a.push(a[i]+d);
  }
//   var ans=a.reduce((A,c)=>Math.min(A,c));
  console.log(a.reduce((A,c)=>Math.min(A,c)));
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


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

int n, m;
int t[13][13];
int main(){
  while(cin >> n, n){
    rep(i,13)rep(j,13)t[i][j]=0;
    rep(i,n)rep(j,n){
      cin >> m;
      t[i][j] = m;
      t[n][j] += m;
      t[i][n] += m;
      t[n][n] += m;
    }
    rep(i,n+1){
      rep(j,n+1){
	printf("%5d",t[i][j]);
      }
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1192
N,K = map(int,input().split())
A = list(map(int,input().split()))
B = A.copy()
B = list(set(B))
n = len(B)

def counter(A):
 counter = {}
 for a in A:
  if(a in counter):
   counter[a] += 1
  else:
   counter[a] = 1
 return counter

ans = 0
if(n > K):
  dict = counter(A)
  count = 1
  #value降順ソート
  for k, v in sorted(dict.items(), key=lambda x: -x[1]):
    if(count > K):
     ans += v
    count += 1
    
print(ans)

Measured memory_bytes: 49688
#include <iostream>
#include <algorithm>
#define rng(x1, y1, x2, y2) (sum[y2][x2] + sum[y1][x1] - sum[y2][x1] - sum[y1][x2])
using namespace std;
int H, W, ra, o, a[40][40], sum[40][40], dp[40][40][40][40];
int solve(int x1, int y1, int x2, int y2) {
	if (dp[y1][x1][y2][x2] != -1) return dp[y1][x1][y2][x2];
	int rng_ = rng(x1, y1, x2, y2);
	int ret = 1048576 + rng_;
	for (int i = x1 + 1; i < x2; i++) {
		int petl = rng(x1, y1, i, y2);
		int petr = rng(i, y1, x2, y2);
		if (min(petl, petr) >= o) {
			int resl = solve(x1, y1, i, y2);
			int resr = solve(i, y1, x2, y2);
			int res = ((resl + resr) >> 20 << 20) + min(resl & 1048575, resr & 1048575);
			ret = max(ret, res);
		}
	}
	for (int i = y1 + 1; i < y2; i++) {
		int petl = rng(x1, y1, x2, i);
		int petr = rng(x1, i, x2, y2);
		if (min(petl, petr) >= o) {
			int resl = solve(x1, y1, x2, i);
			int resr = solve(x1, i, x2, y2);
			int res = ((resl + resr) >> 20 << 20) + min(resl & 1048575, resr & 1048575);
			ret = max(ret, res);
		}
	}
	return dp[y1][x1][y2][x2] = ret;
}
int main() {
	while (cin >> H >> W >> ra, H) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) cin >> a[i][j];
		}
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];
		}
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				for (int k = i + 1; k <= H; k++) {
					for (int l = j + 1; l <= W; l++) dp[i][j][k][l] = -1;
				}
			}
		}
		o = sum[H][W] - ra;
		int ret = solve(0, 0, W, H);
		cout << (ret >> 20) << ' ' << ((ret - o) & 1048575) << endl;
	}
}

Measured memory_bytes: 8976
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int number;
  cin >> number;
  
  bool is_four_kind = false;
  
  for (int i = 0; i < number; i++) {
    string color;
    cin >> color;
    
    if (color == "Y") {
      is_four_kind = true;
      break;
    }
  }
  
  if (is_four_kind) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>

int main(int argc, char const* argv[])
{
	using namespace std;
	
	int a, b, c;
	
	
	cin >> a >> b >> c;
	
	if( a > c && c > b ){
		cout << "Yes" << endl;
	}
	else if( b > c && c > a ){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static int[] dy = new int[4] { 0, 1, 0, -1 };
    static int[] dx = new int[4] { 1, 0, -1, 0 };
    static int RInt() => int.Parse(ReadLine());
    static void Main()
    {
        int N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();

        var sum = 0L;
        var xsum = 0L;
        var ans = 0L;
        int r = 0, l = 0;
        while (true)
        {
            if (sum == xsum)
            {
                ans += l - r;

                if (l == N)
                {
                    break;
                }
                else
                {
                    sum += A[l];
                    xsum ^= A[l];
                    l++;
                }
            }
            else
            {
                sum -= A[r];
                xsum ^= A[r];
                r++;
            }
        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 43156
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

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

signed main(){
  cin.tie(0);	
  //ios::sync_with_stdio(false);
  string s;
  cin>>s;
  int up=1,down=1;
  double num=0;
  int ans;
  bool u=false,z=false;
  rep(i,s.size() ){
    if(s[i]=='.') u=true;
    else if(s[i]=='(' || s[i]==')') z=true;
    else{
      if(z) down*=10;
      else if(u){up*=10;down*=10;}
      if(!u) num=num*10+(s[i]-48);
      else num+=(double)(s[i]-48)/down;
    }
  }
  //cout<<num<<endl;
  // cout<<down<<" "<<up<<endl;
  ans=num*down-num*up;
  ans++;
  //cout<<ans<<endl;
  
  if(z){
    cout<<ans/gcd(ans,down-up)<<"/"<<(down-up)/gcd(ans,down-up)<<endl;
  }else{
    cout<<(int)((num*down)/gcd(num*down,down))<<"/"<<down/gcd(num*down,down)<<endl;
  }
  return 0;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;
 
int main() {
  ll n;cin>>n;
  string s=" ";
    while(n){
      n--;
    s+=n%26+'a';
      n/=26;
    }
  reverse(all(s));
  cout<<s<<endl;
}

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

typedef std::pair<int, int> pii;

const int kN = 1e5 + 5;

int n, k, ans = 0, fa[kN], dep[kN];
std::vector<int> ch[kN];
std::priority_queue<pii> que;
bool vis[kN];

void Dfs(int x) {
	dep[x] = dep[fa[x]] + 1;
	for(int i : ch[x]) Dfs(i);
}
void Fill(int x, int d) {
	vis[x] = true;
	if(!d) return;
	for(int i : ch[x]) Fill(i, d - 1);
}

int main() {
	scanf("%d%d%d", &n, &k, fa + 1);
	if(fa[1] != 1) ++ans, fa[1] = 1;
	for(int i = 2; i <= n; ++i) {
		scanf("%d", fa + i);
		ch[fa[i]].push_back(i);
	}
	Dfs(1); Fill(1, k);
	for(int i = 1; i <= n; ++i)
		if(!ch[i].size() && !vis[i]) que.push(std::make_pair(dep[i], i));
	while(!que.empty()) {
		int v = que.top().second; que.pop();
		if(vis[v]) continue;
		for(int i = 1; i < k; ++i) v = fa[v];
		Fill(v, k - 1); ++ans;
		if(fa[v] != 1) que.push(std::make_pair(dep[fa[v]], fa[v]));
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 9728
#include<iostream>
#include<algorithm>
using namespace std;
#define INF ( 1 << 30 )
int main(){
  int n,d[10000];
  while(cin >> n , n){
    bool ok = false;
    int sum = 0;
    for(int i = 0 ; i < n ; i++ ){
      cin >> d[i];
      if(d[i] >= 1) sum++;
      if(d[i] >= 2) ok = true; 
    }
    if(!ok) cout << "NA" << endl;
    else cout << sum + 1 << endl;
  }
}

Measured memory_bytes: 1200
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int N[200001];
int main()
{
    int i,j,number,temp;
    while(cin>>number){
        for(i=0;i<number;i++){
            cin>>N[i];
        }
        sort(N,N+number);
        for(i=0;i<number;i++)
        {
            if(N[i+1]==N[i]||N[i-1]==N[i]) {cout<<"NO"<<endl;break;}
        }
        if(i==number) cout<<"YES"<<endl;
    }
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
const int INF = 1e18;
void chmin(int &a,int b){
	if(a > b )a = b;
}
signed main(){
	int h,n;cin >> h >> n;
	vector<int> dp(h+1,INF);
	dp[0] = 0;
	rep(i,n){
		int a,b;cin >> a >> b;
		rep(j,h+1){
			chmin(dp[min(j+a,h)],dp[j]+b);
		}
	}
	// trace(dp);
	cout << dp[h] << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
typedef long long lint;

int main(){
    lint N;
    cin >> N;
    for(lint h=1;h<=3500;h++){
        for(lint n=1;n<=3500;n++){
            if(4*h*n-N*h-N*n>0 && N*h*n%(4*h*n-N*h-N*n)==0 && N*h*n/(4*h*n-N*h-N*n)<=3500){
                cout << h << ' ' << n << ' ' << (N*h*n/(4*h*n-N*h-N*n)) << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

def gcd_list(nums):
    return reduce(gcd, nums)

N, X = list(map(int, input().split()))
x = list(map(int, input().split()))

x_sorted = x
x_sorted.append(X)
x_sorted.sort()

diff = []
for i, xi in enumerate(x_sorted):
    if i == 0:
        continue
    else:
        diff.append(xi - x_sorted[i-1])

print(gcd_list(diff))




Measured memory_bytes: 14748
using System;
using System.Linq;
class Program
{
	static void Main(string[] args)
	{
      	Console.ReadLine();
		string[] input = Console.ReadLine().Split(' ');
		int[] intArray = input
		  .Select(int.Parse)
		  .ToArray();
		
      	int num = -1;
      	bool isEnd = false;
      	while (isEnd == false) {
          num++;
          for (var i = 0; i < intArray.Length; i++) {
            if (intArray[i] % 2 == 1) {
              isEnd = true;
              break;
            }
            intArray[i] /= 2; 
          }

        }
      
		//出力
		Console.WriteLine(num);
	}
}

Measured memory_bytes: 13268
import sys
input = sys.stdin.readline
INF = float("inf")


def main():
    D, N = map(int, input().split())
    if N<100:
        ans = (100**D)*N
    else:
        ans = (100**D)*N + (100**D)
    print(ans)



if __name__ == '__main__':
    main()

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

int main(){
  map<char,char>maps;
  int n,m;
  char a,b;
  while(1){
  for(int i=0;i<26;i++){
    maps['A'+i]='A'+i;
    maps['a'+i]='a'+i;
  }
  for(int i=0;i<10;i++){
    maps['0'+i]='0'+i;
  }
  cin>>n;
  if(!n)break;
  while(n--){
    cin>>a>>b;
    maps[a]=b;
  }
  cin>>m;
  char str[m];
  for(int i=0;i<m;i++){
    cin>>a;
    str[i]=maps[a];
  }
  for(int i=0;i<m;i++){
    cout<<str[i];
  }
  cout<<endl;
  }
}

Measured memory_bytes: 1284
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

const int MAXN = int(1 << 18);

int main() {
    string s;
    while (cin >> s) {
          int K;
          set<string> st;
          cin >> K;
          for (int i = 0; i < int(s.length()); i++) {
              string tmp = "";
              for (int j = i; j < i + 5 && j < int(s.length()); j++) {
                  tmp += s[j];
                  st.insert(tmp);
              }
          }
          for (auto i : st) {
              K--;
              if (K == 0) {
                 cout << i << endl;
                 break;
              }
          }
    }
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;  cin >> n;
    vector<int>a(n);
    rep(i, n)   cin >> a[i];
    int ans = 1001001001;
    for(int i = -100; i <= 100; i++){
        int sum = 0;
        rep(j, n)   sum += pow(a[j]-i, 2);
        ans = min(ans, sum);
    }
    cout << ans << endl;
}


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

int main() {

 int K,A,B;
  
  cin >> K;
  cin >> A >> B;
  
 for(int i=A ; i < B+1 ; i++){
   
  if(i%K != 0){
 continue;
  }
   
   else{
   cout << "OK" << endl;
     exit(0);
   }
 }
  cout << "NG" << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int d[N];
    for(int i=0;i<N;i++){
        cin >> d[i];
    }
    sort(d,d+N);
    int L,H;
    L = d[N/2-1];
    H = d[N/2];
    int ans = H - L;
    cout << ans;
}


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

int main(int argc, char const *argv[]) {
  int x;
  cin >> x;
  if(x == 1) {
    cout << 1 << endl;
    return 0;
  }
  int ans = 0;
  for(int i = 2; i <= 1000; i++) {
    for(int j = 2; j <= 1000; j++) {
      if(pow(i, j) > 1000 || pow(i, j) > x) break;
      if(pow(i, j) >= ans) {
        ans = pow(i, j);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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


int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	int L[n];
	int maxi = -1, sum = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> L[i];
		maxi = max(L[i], maxi);
		sum += L[i];
	}

	if(sum-maxi > maxi)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
 

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

     struct rest
     {
         int doub;
         int name;
         string town;
         int score; 
    bool operator<(const rest &another) const
    {
        if(town!=another.town) return town < another.town;
        else return score>another.score;
    };
    };


     vector<rest> dic(n);

     rep(i,n) 
     {
         cin>>dic[i]. town>>dic[i].score;
         dic[i].name = i+1;
     }

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

    rep(i,n) cout<<dic[i].name<<endl;

 }


Measured memory_bytes: 256
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()
	a := scanInts(n)
	for i := 0; i < n; i++ {
		a[i]--
	}

	uf := make(unionFind, n)
	uf.init()
	for i := 0; i < m; i++ {
		x := scanInt()-1
		y := scanInt()-1
		uf.unite(x,y)
	}

	ans := 0
	for i := 0; i < n; i++ {
		if uf.root(i) == uf.root(a[i]) { ans++ }
	}

	fmt.Fprintln(wr, ans)
}

type unionFind []int

func (uf *unionFind) init() {
	for i := 0; i < len(*uf); i++ { (*uf)[i] = -1 }
}

func (uf *unionFind) root(x int) int {
	if (*uf)[x] < 0 { return x }
	(*uf)[x] = uf.root((*uf)[x])
	return (*uf)[x]
}

func (uf *unionFind) unite(x, y int) {
	rx, ry := uf.root(x), uf.root(y)
	if rx != ry {
		if (*uf)[rx] > (*uf)[ry] { rx,ry = ry,rx }
		(*uf)[rx] += (*uf)[ry]
		(*uf)[ry] = rx
	}
}


Measured memory_bytes: 3968
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
double sum=0;
int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		double f;
		string s;
		cin>>f>>s;
		if(s=="JPY") sum+=f;
		else sum+=f*380000;
		
	}
	printf("%.15lf",sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N;
char c[1000][1000];
const string s4[4]{
	"aabc",
	"ddbc",
	"bcaa",
	"bcdd"
};
const string s5[5]{
	"aabbc",
	"dee.c",
	"d..fg",
	"h..fg",
	"hiijj"
};
const string s7[7]{
	"aabbcc.",
	"dd.ee.f",
	"..g..hf",
	"..g..hi",
	"jj.kk.i",
	"..m..nl",
	"..m..nl"
};
void draw4(int x) {
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			c[x + i][x + j] = s4[i][j];
		}
	}
}
void draw5(int x) {
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) {
			c[x + i][x + j] = s5[i][j];
		}
	}
}

void draw7(int x) {
	for (int i = 0; i < 7; i++) {
		for (int j = 0; j < 7; j++) {
			c[x + i][x + j] = s7[i][j];
		}
	}
}

int main() {
	cin >> N;
	if (N == 2) {
		cout << -1 << endl;
	}
	else if (N == 3) {
		cout << "aa." << endl;
		cout << "..b" << endl;
		cout << "..b" << endl;
	}
	else if (N == 6) {
		cout << "...aa." << endl;
		cout << ".....b" << endl;
		cout << ".....b" << endl;
		cout << "aa...." << endl;
		cout << "..b..." << endl;
		cout << "..b..." << endl;
	}
	else {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				c[i][j] = '.';
			}
		}
		for (int i = 0; i < N;) {
			if (N - i == 7) {
				draw7(i);
				break;
			}
			else if ((N - i) % 5 == 0) {
				draw5(i);
				i += 5;
			}
			else {
				draw4(i);
				i += 4;
			}
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				cout << c[i][j];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 2176
import heapq


class DynamicMedian():
    """値をO(logN)で追加し、中央値をO(1)で求める
    add(val): valを追加する
    median_low(): 小さい方の中央値(low median)を求める
    median_high(): 大きい方の中央値(high median)を求める
    """
    def __init__(self):
        self.l_q = []  # 中央値以下の値を降順で格納する
        self.r_q = []  # 中央値以上の値を昇順で格納する
        self.l_sum = 0
        self.r_sum = 0
        
    def add(self, val):
        """valを追加する"""
        if len(self.l_q) == len(self.r_q):
            self.l_sum += val
            val = -heapq.heappushpop(self.l_q, -val)
            self.l_sum -= val
            heapq.heappush(self.r_q, val)
            self.r_sum += val
        else:
            self.r_sum += val
            val = heapq.heappushpop(self.r_q, val)
            self.r_sum -= val
            heapq.heappush(self.l_q, -val)
            self.l_sum += val
            
    def median_low(self):
        """小さい方の中央値を求める"""
        if len(self.l_q) + 1 == len(self.r_q):
            return self.r_q[0]
        else:
            return -self.l_q[0]

    def median_high(self):
        """大きい方の中央値を求める"""
        return self.r_q[0]

    def minimum_query(self):
        """キューに追加されている値 a1,...,aN に対して、|x-a1| + |x-a2| + ⋯ + |x-aN|の最小値を求める
        x = (a1,...,aN の中央値) となる"""
        res1 = (len(self.l_q) * self.median_high() - self.l_sum)
        res2 = (self.r_sum - len(self.r_q) * self.median_high())
        return res1 + res2


q = int(input())
info = [list(map(int, input().split())) for i in range(q)]
dm = DynamicMedian()

b = 0
for i in range(q):
    if info[i][0] == 1:
        _, tmp_a, tmp_b = info[i]
        dm.add(tmp_a)
        b += tmp_b
    else:
        print(dm.median_low(), dm.minimum_query() + b)


Measured memory_bytes: 59868
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int a, b, c;
int main() {
	cin >> a >> b >> c;
	for (int i = a; i < 1000001; ) {
		if (i%b==c) {
			cout << "YES" << endl;
			return 0;
		}
		i += a;
	}
	cout << "NO" << endl;
}

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

int main(){
  int N,M,X,Y; cin >> N >> M >> X >> Y;
  int xmax = X;
  int ymin = Y;
  for (int i=0; i<N; i++) {
    int x;
    cin >> x;
    xmax = max(xmax,x);
  }
  for (int i=0; i<M; i++) {
    int y;
    cin >> y;
    ymin = min(ymin,y);
  }
  if (xmax < ymin) {
    cout << "No War" << endl;
  } else {
    cout << "War" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;

namespace tst
{
    class Program
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string[] In= Console.ReadLine().Split(' ');
            int[] C = new int[n];
            for (int i=0; i<n-1; i++)
            {
                int temp=int.Parse(In[i]);
                C[temp - 1]++;
            }
            for(int i=0; i<n; i++)
            {
                Console.WriteLine(C[i]);
            }
        }
    }
}

Measured memory_bytes: 42136
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcount((unsigned int)x);};

const ll mod = 1e9+7;

const ll size = 3100;
ll fact[size], finv[size];

ll nCk(ll n, ll k){
    if(n < k) return 0;
    return fact[n] * (finv[k]*finv[n-k]%mod) %mod;
}

ll modpow(ll x, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

ll inv(ll x){
    return modpow(x, mod-2);
}

void prepare(){
    fact[0] = 1;
    rep(i, size-1) fact[i+1] = fact[i]*(i+1)%mod;
    finv[size-1] = inv(fact[size-1]);
    for (ll i = size-1; i > 0; i--) {
        finv[i-1] = finv[i]*i%mod;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, K; cin >> N >> K;
    prepare();
    ll rc = N-K;
    ll bc = K;
    
    FOR(i, 1, K+1){
        ll ans = nCk(rc+1, i);
        ll rem = bc-i;
        ans = ans * nCk(rem+i-1, rem) %mod;
        cout << ans << endstr;
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	cout << *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
	return 0;
}

//Ctrl+Aを使わない

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////

int main() {
	ll N; cin >> N;
	cout << (1 + N)*N / 2-N << endl;
	return 0;
}

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

int main(){
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    ll w,w2,w3;
    double g,h;
    ll ans1=-1,ans2=0;
    h=0; 
    rep(i,30){
        rep(j,30){
            w=100*a*i+100*b*j;
            
            if(w<100*a or w>f){
                continue;
            }
            
            else{
                rep(i2,3000){
                    //ans1=w;
                    if((w+d*i2)>f){
                        break;
                    }
                    else if(d*i2>e*(w/100)){
                        break;
                    }
                    else{
                        w3=((e*(w/100)-d*i2)/c)*c+d*i2;
                        w2=w3+w;
                        //cout << i << " " << j << " " << w3 << " " << w2 << endl;
                         if(w2>f){
                             if((w2-f)%c!=0){
                            w3-=((w2-f)/c+1)*c;
                            w2-=((w2-f)/c+1)*c;
                             }
                             else{
                                 w3-=w2-f;
                                 w2-=w2-f;
                             }
                            
                        }
                        //cout << i << " " << j << " " << w3 << " " << w2 << endl;

                        g=w3/double(a*i+b*j);
                        if(g>h){
                            h=g;
                            ans1=w+w3;
                            ans2=ans1-w;
                        }
                    }
                }
            }
        }
    }
    if(ans1==-1){
        ans1=100*a;
    }

    cout << ans1 <<" " <<  ans2 << endl;
    

    return 0;
}

Measured memory_bytes: 256
A = int ( input () )
B = int ( input () )
C = int ( input () )
x = int ( input () )
o = 0
a = A
while a >= 0:
    b = B
    while b >= 0:
        c = C
        while c >= 0:
            m = 500*a + 100*b + 50*c
            if x == m:
                o += 1
            c -= 1
        b -= 1
    a -= 1
print (o)

Measured memory_bytes: 9036
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
from itertools import product#accumulate, combinations, product
#import bisect# lower_bound etc
import numpy as np
#from copy import deepcopy
#from collections import deque
def run():
    H,W,K = map(int, sysread().split())
    S = []
    for i in range(H):
        S.append(list(map(int, list(input()))))
    S = np.array(S)
    ret = float('inf')
    for w in range(1, W):
        S[:,w] += S[:,w-1]
    for h in range(1, H):
        S[h,:] += S[h-1,:]
    S = S.tolist()
    for idxes_ in product((0,1), repeat=H-1):
        l = 0
        r = 1
        idxes = [0]
        for i, val in enumerate(idxes_, 1):
            if val == 1:
                idxes.append(i)
        idxes.append(H)
        min_cut = len(idxes) - 2
        while r <= W:
            for i in range(len(idxes)-1):
                if idxes[i] == 0 and l == 0:
                    cri = S[idxes[i+1]-1][r-1]
                elif l == 0:
                    cri = S[idxes[i+1]-1][r-1] - S[idxes[i]-1][r-1]
                elif idxes[i] == 0:
                    cri = S[idxes[i+1]-1][r-1] - S[idxes[i+1]-1][l-1]
                else:
                    cri = S[idxes[i+1]-1][r-1] - S[idxes[i]-1][r-1] - S[idxes[i+1]-1][l-1] + S[idxes[i]-1][l-1]

                if cri > K:
                    r -= 1
                    if l == r:
                        min_cut = float('inf')
                        r = W+1
                        break
                    l = r
                    min_cut += 1
                    break
            r += 1
        ret = min(ret, min_cut)

    print(ret)




if __name__ == "__main__":
    run()


Measured memory_bytes: 13604
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();
    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let A = buf_it.next().unwrap().parse::<usize>().unwrap();
    let B = buf_it.next().unwrap().parse::<usize>().unwrap();
    let S = buf_it.next().unwrap().chars().collect::<Vec<_>>();

    let mut cntAB = 0;
    let mut cntB = 0;
    for i in 0..N{
        let s = S[i];
        if s == 'c'{
            println!("No");
        } else if s=='a'{
            if cntAB < A+B {
                println!("Yes");
                cntAB += 1;
            } else {
                println!("No");
            }
        } else {
            if cntAB < A+B && cntB < B{
                println!("Yes");
                cntAB += 1;
                cntB += 1;
            } else {
                println!("No");
            }
        }
    }

}

Measured memory_bytes: 4732
S = input()
s_list = [i for i in S]


eng_list = ['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']

dif = set(eng_list) - set(s_list)
if list(dif) == []:
    print('None')
else:print(sorted(list(dif))[0])


Measured memory_bytes: 73740
#include<cstdio>
#include<deque>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long LL;
const int MAXN=100000+5;
const int INF=0x3f3f3f3f;

LL x[MAXN],v[MAXN];
LL dp1[MAXN],dp2[MAXN];

int main()
{
    LL n,c;
    cin>>n>>c;
    for(int i=1;i<=n;i++)
        cin>>x[i]>>v[i];
    LL sm=0;
    for(int i=1;i<=n;i++)
    {
        sm+=v[i]-(x[i]-x[i-1]);
        dp1[i]=max(sm,dp1[i-1]);
    }
    x[n+1]=c;
    sm=0;
    for(int i=n;i>=1;i--)
    {
        sm+=v[i]-(x[i+1]-x[i]);
        dp2[i]=max(sm,dp2[i+1]);
    }
    LL ans=max(dp1[n],dp2[1]);
    for(int i=n;i>=2;i--)
        ans=max(ans,dp2[i]+dp1[i-1]-(c-x[i]));
    for(int i=1;i<=n-1;i++)
        ans=max(ans,dp1[i]-x[i]+dp2[i+1]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
struct _IO{_IO(){ios::sync_with_stdio(0);cin.tie(0);}}_io;
typedef long long ll; typedef long double db;
const int N = 5e3 + 5, M = 1e9 + 7;

int a[N], sum[N];
ll dp[60][60][3000];

int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i-1] + a[i];
  }
  for (int i = 1; i <= n; i++) {
    dp[i-1][0][0] = 1;
    for (int j = 1; j <= n; j++) {
      for (int k = 0; k <= sum[i]; k++) {
        dp[i][j][k] = dp[i-1][j][k];
        if (k >= a[i]) dp[i][j][k] += dp[i-1][j-1][k-a[i]];
      }
    }
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dp[n][i][i * m];
//cout << dp[n][i][i * m] << ' ' << i << '\n';
  }
  cout << ans;;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F first
#define S second
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define sz size()
#define all(A)    A.begin(), A.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define f0(i,b)   for(int i=0;i<(b);i++)
#define f1(i,b)   for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define mod 1000000007

#define forr(i,n)    for(i=0; i<n; i++)
#define whilee(i,t)  while(i!=t)
#define  sl(a)  scanf("%lld",&a)
#define  pl(a)  printf("%lld",a)

//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);
//scanf("%d",&x);
//printf("%d\n",x);

//vector <int> A;
//deque <int> A;
//queue <int> A;
//stack <int> A;
//set <int> A;
//map <int,int> A;
//pair <int,int> A ;
//vector <pair <int,int>> A ;
//char ch;
string S, T, U;
ll i, j, k, a, b, c, d, f, g, h, l, m, n, p, q, r, s, t, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>S;
    reverse(all(S));
    cout<<S<<endl;
    return 0;
}



Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    double area = 0.5 * w * h;
    bool center = 2 * x == w && 2 * y == h;
    printf("%.20f %d\n", area, center);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, from, to) for (int i = from; i < to; i++)
#define sortv(x) sort(x.begin(), x.end())
#define dump(x) cerr << #x << " = " << x << endl
typedef vector<int> vi;
typedef long long ll;

struct UnionFind
{
  vector<int> par;
  UnionFind(int N) : par(N)
  {
    for (int i = 0; i < N; i++)
      par[i] = i;
  }
  int root(int x)
  {
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y)
  {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry)
      return;
    par[rx] = ry;
  }
  bool same(int x, int y)
  {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
} typedef UF;

int main()
{
  int N, M;
  cin >> N >> M;
  vi p(N);
  rep(i, 0, N) cin >> p[i], p[i]--;
  vi x(M), y(M);
  rep(i, 0, M)
  {
    cin >> x[i] >> y[i];
    x[i]--, y[i]--;
  }
  int ans = 0;
  UF uf(N);
  rep(i, 0, M) uf.unite(x[i], y[i]);
  rep(i, 0, N) if (uf.same(i, p[i])) ans++;
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define int long long

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

#ifdef DBG
#define log(item) cout << #item << " " << item << endl
#define loga(array, val) cout << #array << "[" << val << "] " << array [ val ] << endl
#else
#define log(item)
#define loga(array, val)
#endif

typedef vector<int> VI;
typedef pair<int, int> PII;

int lcm(int a, int b){
    int r, x, tmp;
    x = a * b;
    if (a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return x / b;
}

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

int N, K;

vector<PII> ans;

void concat(int a, int b){
    if(K == 0){
        ans.push_back({a, b});
    }
    else{
        K--;
    }
}

signed main(){
    cin >> N >> K;

    rep(from, N){
        for(int to = from + 1; to < N; to++){
            if(to != N - 1){
                concat(from, to);
            }
            else{
                ans.push_back({from, to});
            }
        }
    }

    if(K > 0){
        cout << -1 << endl;
        return 0;
    }

    int size = ans.size();
    cout << size << endl;
    rep(i, size){
        cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 512
a = input()
min = 10000
for target in set(a):
    s = a
    j = 0
    while(1):
        
        if len(set(s)) == 1:
            break
        new_s = ""
        for i in range(len(s)-1):
            if s[i] == target or s[i+1] == target:
                new_s +=target
            else:
                new_s += s[i]
        j+=1;
        if j > min:
            break
        s = new_s
    if min > j:
        min = j

print(min)

Measured memory_bytes: 3064