akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=3e5;
const long long INF=1e18;
int n,x[N],B,q;
long long ans=1e18;
struct Seg
{
    long long a[N<<2];
    void build(int rot,int lt,int rt,int f)
    {
        if(lt==rt){if(lt==B)a[rot]=f*lt;else a[rot]=INF;return;}
        int mid=(lt+rt)>>1;build(rot<<1,lt,mid,f),build(rot<<1|1,mid+1,rt,f);
        a[rot]=min(a[rot<<1],a[rot<<1|1]);
    }
    long long query(int rot,int lt,int rt,int lq,int rq)
    {
        if(lt>=lq&&rt<=rq)return a[rot];
        int mid=(lt+rt)>>1;
        if(rq<=mid)return query(rot<<1,lt,mid,lq,rq);
        if(lq>mid)return query(rot<<1|1,mid+1,rt,lq,rq);
        return min(query(rot<<1,lt,mid,lq,mid),query(rot<<1|1,mid+1,rt,mid+1,rq));
    }
    void update(int rot,int lt,int rt,int q,long long w)
    {
        if(lt==rt){a[rot]=min(a[rot],w);return;}
        int mid=(lt+rt)>>1;
        if(q<=mid)update(rot<<1,lt,mid,q,w);
        else update(rot<<1|1,mid+1,rt,q,w);
        a[rot]=min(a[rot<<1],a[rot<<1|1]);
    }
    void dfs(int rot,int lt,int rt)
    {
        if(lt==rt){ans=min(ans,a[rot]+lt);return;}
        int mid=(lt+rt)>>1;dfs(rot<<1,lt,mid),dfs(rot<<1|1,mid+1,rt);
    }
}s1,s2;
int abs1(int x){return x>=0?x:-x;}
int main()
{
    scanf("%d%d%d%d",&n,&q,&x[0],&B);
    s1.build(1,1,n,-1),s2.build(1,1,n,1);long long add=0;
    for(int i=1;i<=q;i++)
    {
        scanf("%d",&x[i]);long long t=min(s1.query(1,1,n,1,x[i])+x[i],s2.query(1,1,n,x[i],n)-x[i])-abs1(x[i]-x[i-1]);
        add+=abs1(x[i]-x[i-1]);s1.update(1,1,n,x[i-1],t-x[i-1]),s2.update(1,1,n,x[i-1],t+x[i-1]);
    }
    s1.dfs(1,1,n);
    cout<<add+ans<<endl;
}

Measured memory_bytes: 12160
/*input 
2
2 2
*/ 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=5e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=998244353;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
ll arr[maxn];
int main(){
    int n;
    cin>>n;
    ll tot=0;
    REP(i,n){
        cin>>arr[i];
        if(i>1) tot^=arr[i];
    }
    ll c=arr[0]+arr[1];
    ll x=c;
    //a+b=c a^b=tot
    set<int> st;
    set<int> ye;
    REP(i,40){
        if(!((1LL<<i)&tot)){
            st.insert(i+1);
        }
        else{
            ye.insert(i);
            c-=(1LL<<i);
        }
    }
    ll ans=0;
    while(c){
        int z=__lg(lowb(c));
        ans+=((1LL<<(z-1)));
        c-=lowb(c);
    }
    for(int i=39;i>=0;i--){
        if(ye.find(i)!=ye.end()){
            if(ans+(1LL<<i)<arr[0]) ans+=(1LL<<i);
        }
    }
    if((ans^(x-ans))!=tot or arr[0]<ans or ans==0) cout<<-1;
    else cout<<(arr[0]-ans);
} 


Measured memory_bytes: 3628
n = list(input())
n1 = int(n[-1])
if n1 == 2 or n1 == 4 or n1 == 5 or n1 == 7 or n1 == 9:
    print("hon")

elif n1 == 0 or n1 == 1 or n1 == 6 or n1 == 8:
    print("pon")

else:
    print("bon")



Measured memory_bytes: 9160
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = a + b;
    if(c < 10){
      System.out.println(c);
    }else{
      System.out.println("error");
    }
  }
}

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

int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int ans = 999999;
  do {
    int tmp = a[0];
    for (int i = 1; i < 5; i++) {
      int x = ((tmp + 10 - 1)/10)*10;
      tmp = x;
      tmp += a[i];
    }
    ans = min(tmp, ans);
  } while (next_permutation(a.begin(), a.end()));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

struct edge{int to,id;};

int n,m;
vector<vector<edge>> g(60);
vector<bool> used(60);

bool dfs(int v,int pre,int go){
	if(v==go) return true;
	for(auto itr:g[v]){
		if(itr.to==pre) continue;
		if(dfs(itr.to,v,go)){
			used[itr.id]=true;
			return true;	
		}
	}
	return false;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n;
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--,b--;
		g[a].push_back({b,(int)i});
		g[b].push_back({a,(int)i});
	}
	cin>>m;
	vector<ll> cnt(m);
	rep(i,m){
		int u,v;
		cin>>u>>v;
		u--,v--;
		rep(j,60) used[j]=false;
		dfs(u,-1,v);
		rep(j,60){
			if(used[j]){
				cnt[i]|=1ll<<j;
			}
		}
	}
	ll ans=0;
	rep(i,1<<m){
		ll now=0;
		rep(j,m){
			if(i & (1<<j)){
				now|=cnt[j];
			}
		}
		ll now1=1ll<<(n-1-__builtin_popcountll(now));
		if(__builtin_popcountll(i)%2==0) ans+=now1;
		else ans-=now1;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
from sys import stdin


def b(input_string):
    _s = input_string
    s_length = len(_s)
    s = []
    for i in range(s_length):
        s.append(_s[i])
    count = 0
    i = 0
    while(i < len(s)-1):
        #print(s)
        #print(i)
        if s[i] != s[i+1]:
            s.pop(i)
            s.pop(i)
            count += 2
            if i != 0:
                i -= 1
        else:
            i += 1
    return count



def main():
    input_line = stdin.readline().rstrip()
    answer = b(input_line)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0; i < N; i++)
#define INF 1 << 28
#define S second
#define F first
typedef pair<int,int> Pi;

inline void chmax(int &a, int b) { a = max(a,b); }
inline void chmin(int &a, int b) { a = min(a,b); }

int main()
{
  int N, M;
  int dist[1005], temp[1005];
  cin >> N >> M;
  Rep(i,N)cin >> dist[i];
  Rep(i,M)cin >> temp[i];

  int dp[1005][1005];
  fill(dp[0],dp[1],0);
  fill(dp[1],dp[1005],INF);
  for(int i = 1; i <= N; i++) {
    for(int j = 1; j <= M; j++) {
      chmin(dp[i][j],min(dp[i][j - 1],dp[i - 1][j - 1] + dist[i - 1] * temp[j - 1]));
    }
  }
  cout << dp[N][M] << endl;
  return 0;
}

Measured memory_bytes: 7028
import java.util.Scanner;

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

        int n = scan.nextInt();
        int[] heights = new int[n];
        for (int i = 0; i < n; ++i) {
            heights[i] = scan.nextInt();
        }

        int[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(heights[1] - heights[0]);

        for (int i = 2; i < n; ++i) {
            dp[i] = Math.min(dp[i - 2] + Math.abs(heights[i] - heights[i - 2]), dp[i - 1] + Math.abs(heights[i] - heights[i - 1]));
        }

        System.out.println(dp[n - 1]);
    }
}


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

int main() {
long n;
cin >> n;
vector<long>vec(n);
for(long i=0;i<n;i++){
    cin >> vec.at(i);}
    long streak=0;
    long ans=0;
for(long i=0;i<n-1;i++){
    if(vec.at(i)-vec.at(i+1)>=0){streak++;}
    else if(streak>=ans){ans=streak;
    streak = 0;}
    else streak=0;
}

cout << max(ans,streak) <<endl;
}


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

#define ll long long
#define pb push_back
#define ep emplace_back
#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 1e6 + 69;
const int base = 311;

// dung inverse module de tinh kCn
// 67
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<ll>adj[e];
ll gt[e], igt[e], a[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n % mod;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t%mod*t%mod)%mod;
    else return ((t%mod * t%mod)%mod * n %mod)%mod;
}

ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}
*/
int n;

int main()
{
    cin >> n;
    //priority_queue<ll, vector<ll>, greater<ll>>pq;
    ll ans = 0;
    for(int i=1; i<=n; i++)
    {
        ll x;
        cin >> x;
        gt[i] = gt[i-1] + x;
    }
    ll minn = 1e18;
    for(int i=1; i<n; i++)
    {
        ll cur = gt[n] - gt[i];
        minn = min(minn, abs(gt[i] - cur));
    }
    cout << minn;
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String date = sc.nextLine();
		String a = date.replace("/", "");
		if (a.startsWith("0")) {
			a = a.replaceFirst("0", "");
		}

		if (20190430 >= Integer.parseInt(a)) {
			System.out.println("Heisei");
		} else {
			System.out.println("TBD");
		}
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <cstring>
using namespace std;
int main(void){
    char str[205];
    cin>>str;
    int N;
    N=strlen(str);
    bool num[26];
    for(int i=0;i<26;i++){
        num[i]=true;
    }
    int check;
    int count1,count2;
    int c;
    for(int i=0;i<N;i++){
        c=N-1-i;
        check=str[c]-'a';
        if(num[check]==true) num[check]=false;
        else num[check]=true;
        count1=0;
        for(int j=0;j<26;j++){
            if(num[j]==false) count1++;
        }
        count2=0;
        for(int j=0;j<c/2;j++){
           if(str[j]==str[j+c/2]) count2++;
        }
        if(count1==0&&count2==c/2) {break;}
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
ll dp[100000][26];//s[i]からスタートしていくつたどればchar'j'にたどりつけるか
int main()
{
	string s,t;
	ll ans=0;
	cin>>s>>t;
	string tmp=s+s;
	fill(dp[0],dp[100000],1e8-1);
	//最後の文字を調べる
	for(int i=s.size();i<tmp.size();i++)
		dp[s.size()-1][tmp[i]-'a']=min(dp[s.size()-1][tmp[i]-'a'],(ll)i-(ll)s.size()+1LL);
	//最後から2文字目以降は直後の文字を除いてすべて次の文字+1
	for(int i=s.size()-2;i>-1;i--)
	{
		for(int j=0;j<26;j++)
		{
			if(dp[i+1][j]!=1e8-1)
				dp[i][j]=dp[i+1][j]+1;
		}
		dp[i][tmp[i+1]-'a']=1;
	}
	int ind=0;
	if(t[ind]==s[0])
		ind++;
	for(;ind<t.size();ind++)
	{
		//cerr<<dp[ans%s.size()][t[ind]-'a']<<endl;
		if(dp[ans%s.size()][t[ind]-'a']==1e8-1)
		{
			cout<<-1<<endl;
			return 0;
		}
		ans+=dp[ans%s.size()][t[ind]-'a'];
	}
	cout<<ans+1<<endl;
	return 0;
}

Measured memory_bytes: 21120
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100100100;//10^17
const ll MOD = 1000000007;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}


int main(){
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N)cin >> a[i];
    vector<ll> sum(N + 1);
    sum[0] = 0;
    rep(i, N){
        sum[i + 1] = sum[i] + a[i];
    }
    map<ll, ll> m;
    rep(i, N + 1){
        m[sum[i]]++;
    }
    ll ans = 0;
    for(auto x: m){
        ans += (x.second * (x.second - 1)) / 2;
    }
    cout << ans << endl;
}



Measured memory_bytes: 15872
#include <bits/stdc++.h>
 
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<long double> vld;
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846
#define sqr(a) ((a) * (a))
#define len(V) (int)V.size()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define fix(a) fixed << setprecision(a)
#define readv(x) for(auto &_ : (x)) {cin >> _;}
#define printv(x) for(auto &_ : (x)) {cout << _ << ' ';} cout << endl
#define EPS 1e-6
#define MAXN 100047


void solve(){
	int a, b, c, x; cin >> a >> b >> c >> x;
	
	int res = 0;
	FOR(A, 0, a+1)
	FOR(B, 0, b+1)
	FOR(C, 0, c+1)
		if (A*500 + B*100 + C*50 == x) res++;
		
	cout << res << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	solve();
	
	return 0;
}


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=(n);i<(x);++i)
int main() {
	int n;  cin >> n;
	vector<int> v(n); rep(i, 0, n) cin >> v[i];

	map<int, int> even, odd;
	rep(i, 0, n) {
		if (i % 2) odd[v[i]]++;
		else even[v[i]]++;
	}
	int ans = 0;
	pair<int, int> e_mx1(0, 0), e_mx2(0, 0), o_mx1(0, 0), o_mx2(0, 0);
	for (auto x : even) {
		if (e_mx1.second < x.second) {
			e_mx2.first = e_mx1.first; e_mx2.second = e_mx1.second;
			e_mx1.first = x.first; e_mx1.second = x.second;
		}
		else if (e_mx2.second < x.second) {
			e_mx2.first = x.first; e_mx2.second = x.second;
		}
	}
	for (auto x : odd) {
		if (o_mx1.second < x.second) {
			o_mx2.first = o_mx1.first; o_mx2.second = o_mx1.second;
			o_mx1.first = x.first; o_mx1.second = x.second;
		}
		else if (o_mx2.second < x.second) {
			o_mx2.first = x.first; o_mx2.second = x.second;
		}
	}
	if (e_mx1.first != o_mx1.first) ans = n - (e_mx1.second + o_mx1.second);
	else {
		if (e_mx1.second > o_mx1.second) ans = n - (e_mx1.second + o_mx2.second);
		else if (e_mx1.second == o_mx1.second) ans = n - (e_mx1.second + max(e_mx2.second, o_mx2.second));
		else ans = n - (o_mx1.second + e_mx2.second);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5376
#!/usr/bin/python3
# -*- coding: utf-8 -*-


"""
https://beta.atcoder.jp/contests/abc057/tasks/abc57_1
"""

import sys
import math
from inspect import currentframe

def debug(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args), file=sys.stderr)

N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
CD = [tuple(map(int, input().split())) for _ in range(M)]

for ab in AB:
    dist = [abs(cd[0] - ab[0]) + abs(cd[1] - ab[1]) for cd in CD]
    
    print(dist.index(min(dist)) + 1)









Measured memory_bytes: 4620
use std::collections::HashMap;

use proconio::input;

fn main() {
    input! {
        n: usize,
        ab: [(u64, u64); n],
    };
    let mut edges = HashMap::with_capacity(n * 2);
    for (a, b) in ab {
        edges.entry(a).or_insert((0, 0)).0 += 1;
        edges.entry(b).or_insert((0, 0)).1 += 1;
    }
    let mut points = edges.keys().map(|k| *k).collect::<Vec<_>>();
    points.sort();
    let ans = if n % 2 == 1 {
        let target = (n + 1) / 2;
        let mut entry = 0;
        let mut exit = 0;
        let mut ans = 1;
        for i in 0..points.len() - 1 {
            let p = points[i];
            let (a, b) = edges[&p];
            entry += a;
            exit += b;
            if entry >= target && exit < target {
                ans += points[i + 1] - p;
            }
        }
        ans
    } else {
        let target = n / 2;
        let mut entry = 0;
        let mut exit = 0;
        let mut mid1 = (None, None);
        let mut mid2 = (None, None);
        // eprintln!("{:?}", points);
        // eprintln!("{:?}", edges);
        for p in points {
            let (a, b) = edges[&p];
            entry += a;
            exit += b;
            if entry >= target && mid1.0.is_none() {
                mid1.0 = Some(p);
            }
            if entry > target && mid2.0.is_none() {
                mid2.0 = Some(p);
            }
            if exit >= target && mid1.1.is_none() {
                mid1.1 = Some(p);
            }
            if exit > target && mid2.1.is_none() {
                mid2.1 = Some(p)
            }
        }
        // eprintln!("{:?}", mid1);
        // eprintln!("{:?}", mid2);
        mid1.1.unwrap() + mid2.1.unwrap() - mid1.0.unwrap() - mid2.0.unwrap() + 1
    };
    println!("{}", ans);
}


Measured memory_bytes: 23088
#include<iostream>
using namespace std;
int main() {
	char a[50], b[50],pass[100];
	int l=0;
	cin >> a >> b;
	for (int i = 0; a[l]!='\0'; i=i+2) {
		pass[i] = a[l];
		pass[i + 1] = b[l];
		l++;
		pass[i + 2]='\0';
	}
	
	for (int i = 0; pass[i] != '\0';i++) {
		cout << pass[i];
	}
}

Measured memory_bytes: 256
n,q = map(int, input().split())
s = input()
c = [0]*n
for i in range(1,n):
  c[i] += c[i-1]
  if s[i-1:i+1]=='AC': c[i] += 1

for _ in range(q):
  l,r = map(int, input().split())
  print(c[r-1]-c[l-1])

Measured memory_bytes: 7700
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
	string S;
	cin >> S;
	string flg = "Good";
	for (int i = 0; i < (S.size() - 1);++i) {
		if (S[i] == S[i + 1]) {
			flg = "Bad"; 
			break;
		}
	}
	cout << flg << endl;

	return 0;
}

Measured memory_bytes: 256
import sys

s, t = sys.stdin.read().split()
s *= 2

def main():
    n = len(t)
    for i in range(n):
        if s[i:i+n] == t:
            return 'Yes'
    return 'No'
    
if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    map<int, ll> mp;
    const int mod = 1e9+7;
    ll ans = 1;
    mp[-1] = 3;
    for(int i = 0; i < n; i++){
        int x = a[i];
        if (x == 0){
            ans *= mp[-1];
            mp[-1]--;
        }else{
            ll cnt = mp[x-1];
            if (mp.find(x) != mp.end()) cnt -= mp[x];
            ans *= cnt;
        }
        ans %= mod;
        mp[x]++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	long long a[2], b[2];
	cin>>a[0]>>a[1]>>b[0]>>b[1];
	long long max=a[0]*b[0];
	for(int i=0; i<2; i++){
		for(int j=0; j<2; j++){
			if(max<a[i]*b[j])max=a[i]*b[j];
		}
	}
	cout<<max;
	return 0;
}

Measured memory_bytes: 3632
A, B, K = map(int, input().split())
 
ans_A, ans_B = A, B
if K <= A:
  ans_A -= K
elif A+B >= K > A:
  ans_B -= K-A
  ans_A = 0
else:
  ans_A, ans_B = 0, 0
  
print(ans_A, ans_B)

Measured memory_bytes: 9044
#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;
#define lo long
const int lmax=1999999999;
const long long lmx=1999999999999999999;
long long a[100003];
long long n,dp[4004][4004];
int main(){std::ios::sync_with_stdio(false);
cin>>n;
for(int i=1;i<=n;i++){
	cin>>a[i];
}
   for (int l = 0; l < n; l++)
        for (int i = 1; i + l <= n; i++)
            dp[i][i + l] = max (a[i] - dp[i + 1][i + l], a[i + l] - dp[i][i + l - 1]);
cout<<dp[1][n]<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/





Measured memory_bytes: 94208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
int main() {
  int H, W, K; cin >> H >> W >> K;
  vector<vector<char>> vec(H,vector<char>(W));
  rep(i,H)rep(j,W) cin >> vec[i][j];
 
  int ans = 0;
  for (int bit=0; bit<(1<<(H+W)); bit++){
    int count =0;
    for (int i=0; i< H; i++){
      for (int j=0; j< W; j++){
             if(bit & 1<<i || bit & 1<<(j+H) ) continue;
             if (vec[i][j] == '#') count++;      
      }
    }
    if (count == K){
          ans++;
 //         cout << bit << " ";
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main(void){
 int c1,c5,c10,c50,c100,c500;
 cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
 int x = c1*1 + c5*5 + c10*10 + c50*50 + c100*100 + c500*500;
 
  if(1000 <= x){
   cout << 1 << endl;
  }
  else {
   cout << 0 << endl;
  }
} 


Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		// S = 0, H = 1, C = 2, D = 3 ??§?????????
		// ?????????????????????????????????????????????*13 + ??????????????°???-1

		int n = 0;
		boolean number[] = new boolean[52]; // ????????????????????????????????±??????
		int mark = 0;
		int cardNum = 0;

		// n??????????????????????????????????????¨????????????
		Scanner stdIn = new Scanner(System.in);
		n = stdIn.nextInt();

		boolean a = false;
		for (int i = 0; i < n; i++) {

			// ????????????????????\?????????
			String moji = stdIn.next();

			if (moji.equals("S")) {
				mark = 0;
			}
			else if (moji.equals("H")) {
				mark = 1;
			}
			else if (moji.equals("C")) {
				mark = 2;
			}
			else if (moji.equals("D")) {
				mark = 3;
			}

			cardNum = stdIn.nextInt();
			number[mark * 13 + cardNum - 1] = true;
		}

		for (int i = 0; i < number.length; i++) {
			String mark1 = "";	//?????????
			if (number[i] == false) {
				mark = i / 13;

				if (mark == 0) {
					mark1 = "S";
				}
				else if (mark == 1) {
					mark1 = "H";
				}
				else if (mark == 2) {
					mark1 = "C";
				}
				else if (mark == 3) {
					mark1 = "D";
				}

				cardNum = i % 13 + 1;
				System.out.println(mark1 + " " + cardNum);
			}
		}
		stdIn.close();
		if (a) {
			return;
		}

	}

}

Measured memory_bytes: 26232
#include<iostream>
#include<string>

using namespace::std;

int main()
{
    int N,K,Q;
    cin >> N;
    cin >> K;
    cin >> Q;
    int A[Q];
    int res[N] ;
    for(int i=0;i<N;i++)
        res[i] = K;
    for(int i=0;i<Q;i++)
        cin >>A[i];

    for(int i=0;i<Q;i++)
    {
        res[A[i]-1]++;
    }
    for(int i=0;i<N;i++)
    {
        res[i] = res[i] - Q ;
        if(res[i]>0)
            cout<< "Yes" <<endl;
        else
            cout<< "No" <<endl;
    }



}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main(){
	int a,b;
	while(cin >> a >> b){
		int sum = a + b;
		//cout << a << " " << b << " " << sum << endl;
		int n = 1;
		int index = 0;
		while(1){
			if(n > sum) break;
			n *= 10;
			index++;
		}
		//cout << n << " " << index << endl;
		cout << index << endl;
	}
	return 0;
}

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

int main(){
double a , b , c ,d , e , k;
cin >> a >> b >> c >> d >> e >> k;
bool t = (e-a > k);
if (t == true){
    cout << ":(" << endl;
}else{
    cout << "Yay!" << endl;
}
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int N, K;
    ll L, R;
    cin >> N >> K >> L >> R;
    vector<ll> a(N);
    for(int i = 0; i < N; ++i)  cin >> a[i];
    int M = N / 2;
    vector<pair<int, ll>> table;
    for(int bit = 0; bit < (1 << M); ++bit){
        ll S = 0;
        for(int i = 0; i < M; ++i){
            if(bit >> i & 1)    S += a[i];
        }
        table.emplace_back(__builtin_popcount(bit), S);
    }
    sort(table.begin(), table.end());
    ll ans = 0;
    for(int bit = 0; bit < (1 << (N - M)); ++bit){
        int c = __builtin_popcount(bit);
        ll S = 0;
        for(int i = 0; i < N - M; ++i){
            if(bit >> i & 1)    S += a[M + i];
        }
        ans += upper_bound(table.begin(), table.end(), make_pair(K - c, R - S)) - lower_bound(table.begin(), table.end(), make_pair(K - c, L - S));
    }
    cout << ans << endl;
}


Measured memory_bytes: 19380
import java.util.Scanner;
// 0306
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(),a[]=new int[15],i=0;
        while(n>0) {
            a[i++]=(n+1)%3-1;
            n=(n-a[i-1])/3;
        }
        while(i-->0)
            System.out.print((a[i]==0?"0":a[i]>0?"+":"-")+(i==0?"\n":""));
    }
}


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

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

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;

ll ans;
//ここから書き始める
int main()
{
	cout << setprecision(10);
	int n;
	cin >>n;
	int d ,x ;
	cin >> d >> x;
	vector<ll> v(n);
	rep(i,n) cin >> v[i];
	
	int eaten = n; 
	rep(i,n){
			int V = 1+v[i];
		while(V<=d){
			eaten ++;
			V +=v[i];
		}
	}
	cout << eaten + x << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 0X3f3f3f3f
#define M 1000000007
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define mp make_pair
#define pb push_back 
#define fi first
#define se second
#define endl "\n"
#define PI acos(-1)
#define fastcin ios_base::sync_with_stdio(false)
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> ii;
typedef complex<double> base;

string s;
int choice[4][100];

bool solve(int i, int sum){
	if(i == 4){
		if(sum == 7) return 1;
		return 0;
	}
	bool a = solve(i+1, sum + (s[i]-'0'));
	bool b = solve(i+1, sum - (s[i]-'0'));

	if(a) choice[i][sum] = 0;
	else choice[i][sum] = 1;

	return a or b;
}

void printans(int i, int sum){
	if(i == 4){
		// cout << s[i] << "=7" <<  endl;
		cout << "=7" << endl;
		return;
	}

	if(choice[i][sum] == 0){
		cout << "+" << s[i];
		printans(i+1, sum+(s[i]-'0'));
	}
	else{
		cout << "-" << s[i];
		printans(i+1, sum-(s[i]-'0'));
	}
}

int main(void){
	cin >> s;

	solve(1, s[0]-'0');

	cout << s[0];
	printans(1, s[0]-'0');

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ios>
#include <iomanip>

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  int P[100000], Y[100000];
  vector<int > ids[100001];
  for (int i = 0; i < M; i++){
    cin >> P[i] >> Y[i];
    ids[P[i]].push_back(Y[i]);
  }

  for (int i = 0; i < N; i++){
    sort(ids[i+1].begin(),ids[i+1].end());
  }

  for (int i = 0; i < M; i++){
    cout << setfill('0') << right << setw(6) << P[i];
    cout << setfill('0') << right << setw(6) << lower_bound(ids[P[i]].begin() ,ids[P[i]].end() , Y[i])-ids[P[i]].begin()+1 << endl;
  }
  
  
  
}


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

#define ll long long
const int mod = 1e9 + 7;
ll int INF = 1e17;


int n;
int dp[25][1<<22];
int mat[25][25];


ll int kil(int idx, int mask)
{
  if(idx == n)
  {
    if( __builtin_popcount(mask) == n)
      return 1;
    return 0;
  }

  if(dp[idx][mask] != -1)
    return dp[idx][mask];

  dp[idx][mask] = 0;
  for(int j=0;j<n;j++)
  {
    if(mat[idx][j] &&  (mask & (1<<j)) == 0)
      dp[idx][mask] = (dp[idx][mask] + kil(idx+1, mask | (1<<j))) % mod;
  }

  return dp[idx][mask];
}

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

  memset(dp, -1, sizeof dp);
  cin>>n;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      cin>>mat[i][j];

  cout<<kil(0, 0)<<endl;

  return 0;
}


Measured memory_bytes: 409984
#include<stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(x+r<=W&&y+r<=H&&x-r>=0&&y-r>=0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
    }

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

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

const LL  INF=1<<31;



int main(){
     int n,m;
     int t[100];
     int sum=0;
     cin>>n;
     for(int i=0;i<n;++i){
          cin>>t[i];
          sum+=t[i];
     }
     cin>>m;
     vector<P> px(m);
     for(int i=0;i<m;++i){
          cin>>px[i].first>>px[i].second;
     }

     for(int i=0;i<m;++i){
          cout<<sum-t[px[i].first-1]+px[i].second<<endl;;
     }
}

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

int main(){
    string a, b;
    cin >>a >> b;
    if (a.size() < b.size()) return 0;
    for (int i=0;i<=a.size()-b.size();i++){
        bool isMatch=true;
        for (int j=0;j<b.size();j++)
            if (a.at(i+j) != b.at(j)) isMatch = false;
        if (isMatch) cout << i << endl;
    }
}


Measured memory_bytes: 3184
#include <iostream>                                             
#include <algorithm>                                            
#define N 10                                                    
using namespace std;                                            
                                                                
int main(void) {                                                
  int height[10];                                               
  for (int i=0; i<N; i++) {                                     
    cin >> height[i];                                           
  }                                                             
  sort(height,height+N);                                        
  reverse(height,height+N);                                     
  for (int i=0; i<3; i++) {                                     
    cout << height[i] << endl;                                  
  }                                                             
  return 0;                                                     
}                         

Measured memory_bytes: 3096
loop do
  n,m=gets.split.map(&:to_i)
  break if n==0
  px,py,cnt=0,0,0
  arr=Array.new()
  n.times do 
    arr<<gets.chomp.split("")
  end
  loop do
    case arr[py][px]
    when "<" then px-=1
    when ">" then px+=1
    when "^" then py-=1
    when "v" then py+=1
    else break
    end
    cnt+=1
    break if cnt>n*m
  end
  puts cnt>n*m ? "LOOP": "#{px} #{py}"
end

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line


vector<pair<long long,int>> factorize(long long n){
	vector<pair<long long,int>> res;
	for( long long i = 2; i*i <= n; ++i){
		if(n%i) continue ; 
		res.emplace_back(i,0);
		while(n%i == 0){
			n /= i ;
			res.back().second++;
		}
	}
	if ( n != 1) res.emplace_back(n,1);
	return res;
}
int main()
{
	ll n;
	cin >> n;
	// √nまでやればいい
	auto p = factorize(n-1);
	ll ans = 1;
	for(auto x: p){
		ans *= x.second + 1;
	}
	for(ll i = 2; i * i <= n; i++){
		if((n) % i == 0) {
			ll N = n;
			while(N % i == 0){
				N /= i;
			}
			if(N % i == 1){
				ans ++;
			}
		}
	}
	if(n == 2 || n == 3){
		cout << n - 1 << endl;
	} else {
		cout << ans  << endl;
	}
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
    #define ll long long
    #define mo 1000000007
    #define pll pair<ll,ll>
    using namespace std;
    ll f[105];
    vector<pll> s[105];
    void dfs(int x,ll a,ll b){
    if (x>88) return;
    if (b>f[x+1]) return;
    s[x].push_back(pll(a,b));
    dfs(x+1,b,b+a); dfs(x+1,b,b*2+a);
    }
    int main(){
    f[0]=f[1]=1;
    for (int i=2;i<=95;i++)
    f[i]=f[i-1]+f[i-2];
    dfs(1,1,1);
    int Q;
    scanf("%d",&Q);
    while (Q--){
    ll x,y;
    scanf("%lld%lld",&x,&y);
    if (x>y) swap(x,y);
    int ans=0; ll sum=0;
    for (int i=1;i<=100;i++)
    if (f[i]>x||f[i+1]>y){
    ans=i-1;
    break;
    }
    if (ans<=1){
    if (x==1) sum=y%mo;
    else if (x==2) sum=4;
    printf("1 %lld\n",sum);
    continue;
    }
    for (int i=0;i<s[ans].size();i++){
    pll p=s[ans][i];
    if (p.second<=x&&y>=p.first)
    sum=(sum+(y-p.first)/p.second)%mo;
    if (p.second<=y&&x>=p.first)
    sum=(sum+(x-p.first)/p.second)%mo;
    }
    printf("%d %lld\n",ans,sum);
    }
    }

Measured memory_bytes: 4096
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn gcd(a: usize, b: usize) -> usize {
    match (a, b) {
        (a, 0) => a,
        (a, b) => gcd(b, a%b),
    }
}

fn main() {
    input!{
        A: usize,
        B: usize,
    }
    let g = gcd(A, B);
    let mut m = HashSet::new();
    let mut rem = g;
    for i in (2..).take_while(|i| i*i <= g) {
        while rem%i == 0 {
            rem /= i;
            m.insert(i);
        }
    }
    if rem != 1 {
        m.insert(rem);
    }
    println!("{}", m.len() + 1);
}


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

int main(){
  string S;
  string T;
  cin>>S>>T;
  int a[26];
  for(int i=0;i<26;i++){
      a[i]=-1;
  }

  for(int i=0;i<S.length();i++){
    if(a[S.at(i)-'a']==-1){
      a[S.at(i)-'a']=T.at(i)-'a';
    }
    if(a[S.at(i)-'a']>=0){
      if(T.at(i)-'a'==a[S.at(i)-'a']){
        continue;
      }
      else{
        cout<<"No"<<endl;
        return 0;
      }
    }
    
  }
  map<int,int>mp;
  for(int i=0;i<26;i++){
    if(a[i]!=-1){
      mp[a[i]]++;
      if(mp[a[i]]>=2){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }

  cout<<"Yes"<<endl;
  return 0;
}

   

Measured memory_bytes: 776
#include <cstdio>
using namespace std;

int main()
{
	int a, b, c, d, p;
	
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
	
	a *= p;
	
	if (p > c){
		b += d * (p - c);
	}
	
	if (a < b){
		printf("%d\n", a);
	}
	
	else {
		printf("%d\n", b);
	}
	
	return (0);
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };


int H, W;
ll dp[1005][1005];

void solve() {
    cin >> H >> W;
    vector<string> s(H);
    rep(i, H) cin >> s[i];

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    rep(i, H){
        rep(j, W){
            if(i-1 >= 0 && s[i-1][j] == '.') dp[i][j] = modint(modint(dp[i][j]) + modint(dp[i-1][j]));
            if(j-1 >= 0 && s[i][j-1] == '.') dp[i][j] = modint(modint(dp[i][j]) + modint(dp[i][j-1]));
        }
    }

    cout << dp[H-1][W-1] << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 13312
#if defined(__GNUC__)
#include <bits/stdc++.h>
#define __int32 __int32_t
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(ALL(x), greater<decltype(x)::value_type>())
#define RSORT2(x, T) sort(ALL(x), greater<T>())
#define REVERSE(x) reverce(ALL(x))
#define ACM(x, y) accumulate(ALL(x), y)

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)
#define FCT(x) [](int a) -> int {int r = 1; REP(i, a){r *= i;} return r;}(x)

// デバッグ用
#define PUT_LIST(x, y) std::copy(ALL(x), ostream_iterator<decltype(x)::value_type>(cout, y))

const int kMod = 1e9 + 7;

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

	string s;

	cin >> s;

	if (s[0] == s[1] && s[1] == s[2]) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char line[10];
  int cnt_a=0,cnt_b=0,cnt_ab=0,cnt_o=0;
  int i;
  while(scanf("%s", line) != EOF){
    for(i=0;i<10;i++){
      if(line[i]-'A'>=0 && line[i]-'A'<=25){
	break;
      }
    }
    if(line[i] == 'B'){
      cnt_b++;
    }else if(line[i] == 'O'){
      cnt_o++;
    }else if(line[i] == 'A'){
      if(line[i+1] == 'B'){
	cnt_ab++;
      }else{
	cnt_a++;
      }
    }
  }
  printf("%d\n%d\n%d\n%d\n",cnt_a, cnt_b, cnt_ab, cnt_o);
  return 0;
}

Measured memory_bytes: 540
#include<cstdio>
#include<algorithm>
#define ll long long
#define rep(i, l, r) for(int i=l; i<=r; ++i)
#define N 200005
#define mod 1000000007
using namespace std;
int t;
int n;
int a[N];
int main() {
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d", &a[i]);
	sort(a+1, a+n+1);
	bool f=false;
	rep(i, 1, n-1){
		a[n]-=a[i];
		if(a[n]<0) f=true;
	}
	printf(f ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e12;
const long double EPS = 1e-10;

int main() {
  ll n, k ;
  cin >> n >> k ;
  vector<ll> h(n + 1, 0);
  FOR(i, 1, n + 1) cin >> h[i];
  ll dp[n - k + 1][n + 1];
  rep(i, n - k + 1) {
    rep(j, n + 1) {
      dp[i][j] = INF;
    }
  }
  dp[0][0] = 0;
  rep(i, n){
    rep(j, n - k){
      rep(l, i + 1){
        dp[j + 1][i + 1]=min(dp[j + 1][i + 1],dp[j][l]+max(0LL,h[i + 1] - h[l]));
      }
    }
  }

  ll ans = INF;
  rep(i, n + 1){
    ans = min(ans,dp[n - k][i]);
  }
  cout << ans << endl;
  
  return 0;
}

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

int main() {
  int n,t;
  cin >> n>>t;
  
  vector<vector<int>> route(n, vector<int>(2));
  for (int i=0; i<n; ++i) {
    for (int j=0; j<2; ++j) {
      cin >> route.at(i).at(j) ;
    }
  }
  
  int anscopy=1001;
  for (int i=0; i<n; ++i) {
    for (int j=0; j<2; ++j) {
      if (route.at(i).at(1) <= t) {
        if (anscopy >= route.at(i).at(0)) {
          anscopy = route.at(i).at(0);
        }
      }
    }
  }
  
  if (anscopy == 1001) cout << "TLE";
  else cout << anscopy;
}

Measured memory_bytes: 256
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>

#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>

using namespace std;

int gcd(int x,int y){
  //cout << x << ',' << y << endl;
  if(x == 0)return y;
  return gcd(y%x,x);
}

int main(){
  int x,y;
  while(cin >> x >> y){
    int tmp = gcd(x,y);
    cout << tmp  << ' '<< (x)*(y/tmp) << endl;
  }
  return 0;
}

Measured memory_bytes: 1160