akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>

using namespace std;
/* typedef */
typedef long long ll;
/* constant */
/* global variables */
/* function */
/* main */
int main(){
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    vector< set<int> > isAlpha(26);
    for (int i = 0; i < N; i++) isAlpha[S[i] - 'a'].insert(i);

    int op, l, r;
    char c;
    for (int q = 0; q < Q; q++) {
        cin >> op;
        if (op == 1) {
            cin >> l >> c;
            l--;
            isAlpha[S[l] - 'a'].erase(l);
            S[l] = c;
            isAlpha[c - 'a'].insert(l);
        }
        else {
            cin >> l >> r;
            l--;
            int ans = 0;
            for (int i = 0; i < 26; i++) {
                auto itr = isAlpha[i].lower_bound(l);
                if (itr != isAlpha[i].end() && *itr < r) ans++;
            }
            cout << ans << '\n';
        }

    }
}


Measured memory_bytes: 24196
/* C Breadth First Search */
#include<stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
int time;
int A[101][101]; /* 1<= n <= 100 */
int color[101];
int d[101];
int head=0,tail=0;


void BFS(int s);
void Enqueue(int Q[],int s);
int Dequeue(int Q[]);

int main(){
  int i,j;
  int u,k,v;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      A[i][j]=0;
    }
  }
  

  for(i=1;i<=n;i++){
    scanf("%d %d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      A[u][v]=1;
    }
  }
  
  BFS(1);

  for(i=1;i<=n;i++){
    printf("%d %d\n",i, d[i]);
  }

  return 0;
}

void Enqueue(int Q[],int s){
  Q[tail]=s;
  tail++;
}

int Dequeue(int Q[]){
  head++;
  return Q[head-1];
}

void BFS(int s){
  int i;
  int Q[101];
  int u;

  for(i=1;i<=n;i++){
    color[i]=WHITE;
    d[i]=-1;
  }
  color[s]=GRAY;
  d[s]=0;
  Enqueue(Q,s);
  
  while(head!=tail){
    u=Dequeue(Q);
    for(i=1;i<=n;i++){
      if(A[u][i]==1){   /* check array element */
	if(color[i]==WHITE){
	  color[i]=GRAY;
	  d[i]=d[u]+1;
	  Enqueue(Q,i);
	}
      }
    }
    color[u]=BLACK;
  }
}

Measured memory_bytes: 0
def main(n, s):
    if n % 2 != 0:
        print("No")
        return

    if s[:n//2] == s[n//2:]:
        print("Yes")
        return
    
    print("No")
    return

if __name__ == "__main__":
    n = int(input())
    s = input()
    main(n, s)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int a, b, c;
    cin >> a >> b >> c;
    int cost1 = abs(a-b);
    int cost2 = abs(b-c);
    int cost3 = abs(a-c);
    cout << cost1 + cost2 + cost3 - max({cost1, cost2, cost3});
    
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int n,ans=0;
    scanf("%d",&n);
    char s[n];
    scanf("%s",s);
    if(n%2==1) printf("No");
    else{
        for(int i=0;i<n/2;i++){
            if(s[i]!=s[i+(n/2)]){ans=1; break;}
        }
        if(ans==1)printf("No");
        else printf("Yes");
    }
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;

#define fst first
#define scd second
#define rep(i,x) for(int i=0;i<(int)(x);++i)

typedef long long ll;
typedef vector<int> vi;

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

typedef pair<int, vi> Data;

bool check(vi& brd)
{
	for (int i = 0; i < 9; ++i) if (brd[i] != brd[0]) return false;
	for (int i = 9; i < 12; ++i) if (brd[i] != brd[9]) return false;
	for (int i = 12; i < 15; ++i) if (brd[i] != brd[12]) return false;
	for (int i = 15; i < 18; ++i) if (brd[i] != brd[15]) return false;
	for (int i = 18; i < 21; ++i) if (brd[i] != brd[18]) return false;
	for (int i = 21; i < 30; ++i) if (brd[i] != brd[21]) return false;

	return true;
}

void swap(vi& brd, int type)
{
	if (type == 0) {
		swap(brd[9 - 1], brd[24 - 1]);
		swap(brd[8 - 1], brd[23 - 1]);
		swap(brd[7 - 1], brd[22 - 1]);

		swap(brd[10 - 1], brd[12 - 1]);

		swap(brd[13 - 1], brd[18 - 1]);
	} else if (type == 1) {
		swap(brd[1 - 1], brd[28 - 1]);
		swap(brd[2 - 1], brd[29 - 1]);
		swap(brd[3 - 1], brd[30 - 1]);

		swap(brd[19 - 1], brd[21 - 1]);

		swap(brd[15 - 1], brd[16 - 1]);
	} else if (type == 2) {
		swap(brd[1 - 1], brd[24 - 1]);
		swap(brd[4 - 1], brd[27 - 1]);
		swap(brd[7 - 1], brd[30 - 1]);

		swap(brd[16 - 1], brd[18 - 1]);

		swap(brd[10 - 1], brd[21 - 1]);
	} else if (type == 3) {
		swap(brd[3 - 1], brd[22 - 1]);
		swap(brd[6 - 1], brd[25 - 1]);
		swap(brd[9 - 1], brd[28 - 1]);

		swap(brd[13 - 1], brd[15 - 1]);

		swap(brd[12 - 1], brd[19 - 1]);
	}
}

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

	while (N--) {
		vi pzl(30);
		rep(i, 30) cin >> pzl[i];

		queue<Data> q;
		q.push(Data(0, pzl));

		while (q.size()) {
			Data data = q.front();
			q.pop();

			int b = data.fst;

			vi state = data.scd;

			if (check(state)) {
				cout << b << endl;
				break;
			}

			if (b >= 8) continue;

			for (int i = 0; i < 4; ++i) {
				swap(state, i);

				q.push(Data(b + 1, state));

				swap(state, i);
			}
		}
	}
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

struct unionfind {
  vector<int> dat;

  unionfind(int n) : dat(n, -1) {}

  int find(int x) {
    if (dat[x] < 0) return x;
    return dat[x] = find(dat[x]);
  }

  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (dat[x] > dat[y]) swap(x, y);
    dat[x] += dat[y];
    dat[y] = x;
    return true;
  }

  int size(int x) {
    return -dat[find(x)];
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

pair<bool, int> check() {
  ll N, M, Q; cin >> N >> M >> Q;
  vector<int> A(Q), B(Q), C(Q);
  rep(i, Q) cin >> A[i] >> B[i] >> C[i];
  if (count(range(C), 0) == Q) {
    if (M == N - 1) return {true, 2000};
    else return {false, 2001};
  }
  unionfind I(N);
  rep(i, Q) if (C[i] == 0) {
    if (I.unite(A[i], B[i])) {
      M--;
    }
  }
  rep(i, Q) if (C[i] == 1 && I.same(A[i], B[i])) return {false, 1};
  ll cnt = 0;
  rep(i, N) cnt += I.find(i) == i;
  if (cnt <= 2) return {false, 404};
  if (cnt <= M && M <= cnt * (cnt - 1) / 2) return {true, 1234};
  return {false, 404};
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  auto ans = check();
  cerr << ans.second << endl;
  cout << (ans.first ? "Yes" : "No") << endl;
}


Measured memory_bytes: 1792
import java.util.*;

class Main{
  public static void main(String[] args){
    int x = 0;
    int xmax = 0;
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    for(int i = 0;i < N;i++){
      /*if文があやしい。だめなら一旦
      String Spart = S.substring(i.i + 1);
      として、ifの条件式にSpartと入れてみようかな*/
      if(S.substring(i,i + 1).equals("I")){
        x++;
      }else{
        x--;
      }
      if(x > xmax){
        xmax = x;
      }
    }
    System.out.println(xmax);

  }
}


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

int main(){
    int n;
    string s;
    int i;
    int a;
    cin >> n;
    a = n;
    cin >> s;
    for(i = 0;i < n - 1;i++){
        if(s[i] == s[i + 1]){
            a = a - 1;
                    }
        
    }
    cout << a << endl;
    return 0;
}


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

  int N ;
  int ans = 0 ;
  cin >> N ;
  vector<int> A(N) ;
  vector<int> B(N) ;
  rep(i,N) cin >> A.at(i) ;
  int c = A.at(0) ; 
  rep(i,N){
    c = min(c,A.at(i)) ;
    B.at(i) = c ;
  }
  //rep(i,N)cout << A.at(i) ;
  //cout << endl;
  //rep(i,N) cout << B.at(i) ;
  rep(i,N) if(A.at(i) == B.at(i) ) ans++ ;
  cout << ans << endl;
 }
  

Measured memory_bytes: 1792
H,W=list(map(int,input().split()))
A=[list(input()) for i in range(H)]
a=0
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            a+=1

if a==H+W-1:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N;
  vector<long long> a(5);
  cin >> N >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (int i=0;i<4;i++){
    if (a[i]<a[i+1]){
      a[i+1]=a[i];
    }
  }
  long long x=a[4];
  long long ans=4+(N+x-1)/x;
  cout << ans << endl;
}
  

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
 int a,b,c,d,min1,min2;
 scanf("%d%d%d%d",&a,&b,&c,&d);
 if(a<=b){
 min1=a;
 }else{
 min1=b;
}

 if(c<=d){
 min2=c;
 }else{
 min2=d;
}

printf("%d",min1+min2);

 return 0;
}


Measured memory_bytes: 128
A, B, M = map(int, input().split())
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
c = [[] for _ in range(M)]
for i in range(M):
    c[i] = list(map(int, input().split()))

minprice = min(a)+min(b)
for i in range(M):
    p = a[c[i][0]-1]+b[c[i][1]-1]-c[i][2]
    minprice = min(p, minprice)

print (minprice)


Measured memory_bytes: 39728
#include <bits/stdc++.h>
using namespace std;
int main (){
int a,b,c,z1,z2,z3,v;
cin>>a>>b>>c;
z1=a+b;
z2=a+c;
z3=b+c;
v=min(z1,z2);
cout<<min(v,z3);
 return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main(){
	string S;
	cin >> S;
	if(S.size() == 3){
    reverse(S.begin(),S.end());
  }
  cout << S << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<iomanip>
#include<stdlib.h>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;
#define loop(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);(i)++)
#define rloop(i,l,r) for(int (i)=(int)(l);(i)>(int)(r);(i)--)
#define rep(i,n) loop(i,0,n)
#define rrep(i,n) rloop(i,n-1,-1)
#define INF 0x3f3f3f3f
#define mod 1000000007
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

int main(){
	int n,dx,dy,x,y,mx,my,tmp1,tmp2;
	cin>>n;
	while(n--){
		x=y=mx=my=0;
		while(1){
			cin>>dx>>dy;
			if(dx==0&&dy==0)break;
			x+=dx;
			y+=dy;
			tmp1=x*x+y*y;
			tmp2=mx*mx+my*my;
			if(tmp1>tmp2||tmp1==tmp2&&(x*x>mx*mx)){
				mx=x;
				my=y;
			}
		}
		cout<<mx<<" "<<my<<endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    int n; cin >> n;
    int ans = 0; int max_h = 0;
    int h;
    for(int i=0;i<n;i++){
        cin >> h;
        if(h>=max_h) ans++;
        max_h = max(max_h,h);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-16 07:22:24
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int n; cin >> n;
  int64 l; cin >> l;
  vector<int64> a(n); cin >> a;

  int pos = -1;

  for (int i = 0; i < n - 1; ++i) {
    if (a[i] + a[i + 1] >= l) {
      pos = i; break;
    }
  }

  if (pos == -1) {
    cout << "Impossible" << endl; return 0;
  }

  cout << "Possible" << '\n';

  debug(pos);

  ++pos;

  for (int i = 1; i < pos; ++i) {
    cout << i << '\n';
  }

  for (int i = n - 1; i >= pos; --i) {
    cout << i << '\n';
  }

  return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin >> n;
	map<int,int> m;
	for(int i=0;i<n;i++){
		int a;
		cin >> a;
		m[a]++;
	}
	vector<long long> v;
	for(auto i=m.begin();i!=m.end();i++){
		for(int j=0;j<i->second/2;j++) v.push_back(i->first);
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	if(v.size()<=1) cout << 0 << endl;
	else cout << v[0]*v[1] << endl;
}


Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<set>
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
	string s, s1, s2;
	int N, min = 0,num=0;
	cin >> N >> s;
	set<char>st1,st2;
	for (int i = 0;i < N - 1;i++) {
		st2.clear();
		st1.insert(s[i]);
		for (int j = i + 1;j < N;j++) {
			for (auto itr = st1.begin();itr != st1.end();++itr) {
				if (s[j] == *itr) {
					st2.insert(s[j]);
					num = st2.size();
				}
			}
			if (num >= min)min = num;
		}
	}
	cout << min << endl;
	return 0;

}

Measured memory_bytes: 256
#[allow(unused_imports)] use proconio::{input, marker::{Bytes, Chars, Usize1, Isize1}};
#[allow(unused_imports)] use std::cmp::{min, max};
#[allow(unused_imports)] use superslice::Ext as _;

#[proconio::fastout]
fn main() {
	input! {
		a: isize,
		b: isize,
		c: isize,
		d: isize,
	}

	if (a-c).abs() <= d || ((a-b).abs() <= d && (b-c).abs() <= d) {
		println!("Yes");
	}
	else {
		println!("No");
	}
}


Measured memory_bytes: 2120
#include<cstdio>
#include<algorithm>
using namespace std;
int a[200005];
int cmp(const int &x,const int &y) {return x>y;}
int main()
{
	int n,k,x;scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&x),a[x]++;
	sort(a+1,a+n+1,cmp);
	int ans=0;
	for(int i=k+1;i<=n;i++) ans+=a[i];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
import queue
n = int(input())

abc = [[] for i in range(n+1)]

for i in range(n-1):
    a,b,c = map(int,input().split())
    abc[a].append([b,c])
    abc[b].append([a,c])

Q,k = map(int,input().split())
xy = [[int(i) for i in input().split()] for j in range(Q)]

q = queue.Queue()

q.put(k)

path = [-1]*(n+1)
path[k] = 0

while not q.empty():
    tmp = q.get()
    for i in range(len(abc[tmp])):
        #print(abc[tmp])
        #exit()
        num = abc[tmp][i][0]
        if path[num] != -1:
            continue
        else:
            path[num] = path[tmp] + abc[tmp][i][1]
            q.put(num)
            
for i in range(Q):
    print(path[xy[i][0]]+path[xy[i][1]])

Measured memory_bytes: 113180
#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>

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

using namespace std;

int main() {
    int T, X; cin >> T >> X;
    cout << (float)T / X << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    COMinit();

    int x, y;
    cin >> x >> y;
    ll ans = 0;
    rep(i, max(x,y)+1)
    {
        if ((x - i) % 2 == 0)
        {
            int m = (x - i) / 2;
            int n = i;
            if (((n + 2 * m )== x) && ((2 * n + m) == y) &&
             n >= 0 && m >= 0)
            {
                ans += COM(n + m, n);
                ans %= M;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 23680
n = int(input())
a = list(map(int, input().split()))

dp1 = [x for x in a]
dp2 = [0 for _ in range(1<<n)]

for j in range(n+1):
	for i in range(1<<n):
		if i & (1<<j):
			if dp1[i & ~(1<<j)] >= dp1[i]:
				if dp2[i & ~(1<<j)] >= dp1[i]:
					dp2[i] = dp2[i & ~(1<<j)]
				else:
					dp2[i] = dp1[i]
				dp1[i] = dp1[i & ~(1<<j)]
			else:
				if dp1[i & ~(1<<j)] >= dp2[i]:
					dp2[i] = dp1[i & ~(1<<j)]

ans = 0
for i in range(1, 1<<n):
	ans = max(ans, dp1[i]+dp2[i])
	print(ans)

Measured memory_bytes: 121388
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#include<unordered_map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;


int main() {

	int N, L;

	cin >> N >> L;

	vector<string> a(N);
	map<string, int> f;
	rep(i, N) {
		cin >> a[i];
		f[a[i]] += 1;
	}
	
	for (auto i = f.begin(); i != f.end(); i++) {
		rep(j, i->second) {
			cout << i->first;
		}

	}
	cout << endl;
	return 0;
}

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

dp=[[0 for _ in range(W)] for _ in range(H+1)] #0~H,0~W-1
dp[0][0]=1
P=10**9+7


def check(l):
    for i in range(len(l)-1):
        if l[i+1]+l[i]==2:
            return False
    return True

for i in range(1,H+1):
    for w in range(W):
        X,Y,Z=0,0,0
        for j in range(2**(W-1)):
            tmp=[]
            for k in range(W-1):
                tmp.append(j>>k&1)
            if check(tmp):
                if w-1>=0 and (j>>(w-1))&1==1:
                    dp[i][w-1]+=dp[i-1][w]
                    dp[i][w-1]%=P
                elif w<=W-2 and j>>w&1==1:
                    dp[i][w+1]+=dp[i-1][w]
                    dp[i][w+1]%=P
                else:
                    dp[i][w]+=dp[i-1][w]
                    dp[i][w]%=P
print(dp[H][K-1])

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, A, B, V[50];

ll combination(ll n, ll r) {
  static ll comb[51][51];
  ll &ret = comb[n][r];
  if(ret != 0) return ret;
  if(n == 0 || r == 0) return ret = 1;
  if(n == r) return ret = 1;
  if(r == 1) return ret = n;
  return ret = combination(n - 1, r - 1) + combination(n - 1, r);
}

int main(void) {
  cin >> N >> A >> B;
  REP(i, 0, N) cin >> V[i];

  sort(V, V + N);

  double ave;
  ll sum = 0;
  REP(i, 0, A) sum += V[N - i - 1];
  ave = (double) sum / A;

  ll ans = 0;
  ll c = upper_bound(V + (N - A), V + N, V[N - A]) - lower_bound(V + (N - A), V + N, V[N - A]);
  ll d = upper_bound(V, V + N, V[N - A]) - lower_bound(V, V + N, V[N - A]);
  if(V[N - 1] != V[N - A]) ans = combination(d, c);
  else REP(i, c, min(B, d) + 1) ans += combination(d, i);

  printf("%.8lf\n%lld\n", ave, ans);
}


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

int main(void){
    int n, l[220];
    cin >> n;
    for(int i=0;i<2*n;++i) cin >> l[i];
    sort(l, l+2*n);
    int sum = 0;
    for(int i=0;i<2*n;++i){
        sum += l[i];
        ++i;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1];}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const objvs =(a)=>{const b=[];for(const v in a){b.push(a[v])}return b};const deduplicate=(a):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let s=ts().split('')
  let a=s.length;
  s=deduplicate(s)
  to(a==s.length?'yes':'no')
}
main()


Measured memory_bytes: 7372
n=int(input())
a=list(map(int,input().split()))
l=[]
t=0

for i in range(n-1):
    if i==n-2:
        if a[i+1]==a[i]:
            t+=2
            l.append(t)
        else:
            t+=1
            l.append(t)
            l.append(1)
        continue      
    if a[i+1]==a[i]:
        t+=1
    else:
        t+=1
        l.append(t)
        t=0
# print(l)
ans=0
for ll in l:
    ans+=ll//2
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
clock_t __my_start_clock = clock();
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

int main() {
#ifdef LOCAL
  freopen("b.in", "r", stdin);
  freopen("b.out", "w", stdout);
#endif

  int n;
  while (scanf("%d", &n) == 1) {
    multiset<int, greater<int>> a;
    for (int i = 0; i < n; i++) {
      int x;
      scanf("%d", &x);
      a.insert(x);
    }

    int res = 0;

    while (!a.empty()) {
      int x = *a.begin();
      a.erase(a.begin());
      int t = 1;
      while (t <= x) t *= 2;
      if (a.find(t - x) != a.end()) {
        res++;
        a.erase(a.find(t - x));
      }
    }

    printf("%d\n", res);
  }

  return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector <int> ball(n, 1);
  vector <int> red(n, 0);
  red.at(0) = 1;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    if ((red.at(x) > 0) && (ball.at(x) > 1)) {
      red.at(y) = 1;
    } else if ((red.at(x) > 0) && (ball.at(x) = 1)) {
      red.at(x) = 0;
      red.at(y) = 1;
    }
    ball.at(x)--;
    ball.at(y)++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (red.at(i) > 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

class Procon {
    static void Main (string[] agrs) {
        int N = Int ();
        Console.WriteLine (N * N * N);
    }

    static string String () => Scanner.nextString ();
    static int Int () => int.Parse (Scanner.nextString ());
    static long Long () => long.Parse (Scanner.nextString ());
    static double Double () => double.Parse (Scanner.nextString ());
    static char[] Chars () => String ().ToCharArray ();
    static string[] Strings () => Console.ReadLine ().Split (' ');
    static int[] Ints () => Strings ().Select (v => int.Parse (v)).ToArray ();
    static long[] Longs () => Strings ().Select (v => long.Parse (v)).ToArray ();
    static double[] Doubles () => Strings ().Select (v => double.Parse (v)).ToArray ();
    const int M = 1000000007;
}

class PriorityQueue<T> where T : IComparable<T> {
    public T[] heap;
    public int size;
    public int sign;
    public PriorityQueue (int N, bool descend = false) {
        heap = new T[N];
        sign = 1;
        if (descend) sign = -1;
    }
    public int Compare (T x, T y) {
        return x.CompareTo (y) * sign;
    }
    public void Push (T x) {
        int i = size++;
        while (i > 0) {
            int p = (i - 1) / 2;
            if (Compare (x, heap[p]) >= 0) {
                break;
            }
            heap[i] = heap[p];
            i = p;
        }
        heap[i] = x;
    }
    public T Pop () {
        T ret = heap[0];
        T x = heap[--size];
        int i = 0;
        while (i * 2 + 1 < size) {
            int a = i * 2 + 1;
            int b = i * 2 + 2;
            if (b < size && Compare (heap[a], heap[b]) > 0) {
                a = b;
            }
            if (Compare (heap[a], x) >= 0) {
                break;
            }
            heap[i] = heap[a];
            i = a;
        }
        heap[i] = x;
        return ret;
    }
    public int Count () {
        return size;
    }
}

class Scanner {
    static string[] s = new string[0];
    static int i = 0;
    static int max_i = 0;
    static public string nextString () {
        if (i >= s.Length) {
            s = Console.ReadLine ().Split (' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0) {
                return "";
            }
            return s[i++];
        }
        return s[i++];
    }
}

Measured memory_bytes: 11092
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val A = Array.fill(3)(sc.nextInt)

    if (A.sum >= 22) "bust" else "win"
  }
}


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

#define _overload3(_1,_2,_3,name,...) name
#define rep(i,n) for(int i=0;i<(n);++i)

#define out(v) cout<<v<<"\n"

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

  int p[N];
  int a[N], b[N];
  int r[N];
  rep(i, N) {
    cin >> p[i];
    --p[i];
    r[p[i]] = i + 1;
  }
  rep(i, N) {
    a[i] = 30000 * (i+1);
    b[i] = 30000 * (N-(i+1)) + r[i];
  }
  rep(i, N) {
    if (i) cout << " ";
    cout << a[i];
  }
  cout << "\n";
  rep(i, N) {
    if (i) cout << " ";
    cout << b[i];
  }
  cout << "\n";

  return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int x = (a+b)/2;
    if(a+b == x*2){
      System.out.println(x);
    }else{
      System.out.println("IMPOSSIBLE");
    }
  }
}


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

int main()
{
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  if (a >= k)
  {
    cout << k << endl;
  }
  else if (a + b >= k)
  {
    cout << a << endl;
  }
  else
  {
    cout << a - (k - a - b) << endl;
  }
}


Measured memory_bytes: 3580
n, m = [int(i) for i in input().split(" ")]

l = list(range(1, n+1))
divider = 10**9 + 7
ans = [0]*(n + 1)
broken = [False]*(n+1)
ans[0] = 1
ans[1] = 1

for i in range(m):
    a = int(input())
    broken[a] = True
    if a == 1:
        ans[1] = 0
    
for i in range(2,n+1):
    if broken[i] == False:
        ans[i] = ans[i-1] + ans[i-2]
    
   
print(ans[n] % divider)

Measured memory_bytes: 464756
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  string a,b,c;
  cin >> a >> b >> c;
  transform(a.begin(),a.end(),a.begin(),::toupper);
  transform(b.begin(),b.end(),b.begin(),::toupper);
  transform(c.begin(),c.end(),c.begin(),::toupper);
  cout << a[0] << b[0] << c[0] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
int main(){
  int K;
  cin >> K;
  int a[2] = {0,0};
  string c[] = {"mamoru","tameru","kougekida"};
  vector<string> Isono(K), Naka(K);
  for(int i  = 0; i < K; ++i) cin >> Isono[i];
  for(int i  = 0; i < K; ++i) cin >> Naka[i];
  for(int i = 0; i < K; ++i){
    //cout << a[0] << " " << a[1] << endl;
    string s = Isono[i], t = Naka[i];
    if(s == c[1]) a[0] = min(a[0]+1, 5);
    if(t == c[1]) a[1] = min(a[1]+1, 5);
    if(s == c[2] && t == c[2]){
      if(a[0] != a[1]){
        if(a[0] > a[1]){
          cout << "Isono-kun" << endl;
          return 0;
        }
        cout << "Nakajima-kun" << endl;
        return 0;
      }
      a[0] = 0;
      a[1] = 0;
      continue;
    }
    if(s == c[2]){
      if(!a[0]){
        cout << "Nakajima-kun" << endl;
        return 0;
      }
      if(t == c[0] && a[0] < 5){
        a[0] = 0;
        continue;
      }else{
        cout << "Isono-kun" << endl;
        return 0;
      }
    }
    if(t == c[2]){
      if(!a[1]){
        cout << "Isono-kun" << endl;
        return 0;
      }
      if(s == c[0] && a[1] < 5){
        a[1] = 0;
        continue;
      }else{
        cout << "Nakajima-kun" << endl;
        return 0;
      }
    }
  }
  cout << "Hikiwake-kun" << endl;
  return 0;
}



Measured memory_bytes: 3224
N=list(input())
A=[]
for i in range(2**3):
   B=[0]*3
   for j in range(3):
      if i>>j&1:
         B[j]=1
   A.append(B)


for i in range(8):
   s=int(N[0])
   for j in range(3):
      if A[i][j]==0:
         s+=int(N[j+1])
      else:
         s-=int(N[j+1])
   if s==7:
      ans=[]
      for k in range(4):
         ans.append(N[k])
         if k<3:
            if A[i][k]==0:
               ans.append("+")
            else:
               ans.append("-")   
      print(''.join(ans)+'=7')   
      exit()

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> l(n+1, 0), r(n+1, 0);
    for(long i=1; i<n+1; i++){
        long a;
        cin >> a;
        if(i-a > 0) l[i-a]++;
        if(i+a < n+1) r[i+a]++;
    }
    long long ans = 0;
    for(int i=0; i<n+1; i++){
        ans += ((long long)l[i] * (long long)r[i]);
    }

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


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

int main()
{

#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif
    
    
    int n;
    scanf("%d", &n);
    
    int ok = 1;
    for (int i = 0; i < n; ++i)
    {
        static int x;
        scanf("%d", &x);
        ok *= ((x + 1) & 1);
    }
    
    if (ok)
        printf("second");
    else
        printf("first");
    
}


Measured memory_bytes: 256
n,m = map(int,input().split())
a = list(map(int,input().split()))

import heapq
a = list(map(lambda x:x*(-1),a))
heapq.heapify(a)

for i in range(m):
    b = heapq.heappop(a)
    heapq.heappush(a,-(-b//2))
    
print(sum(a)*(-1))

Measured memory_bytes: 19960
import numpy as np
n, m = map(int, input().split())
a = np.zeros((n, n))
b = np.zeros((m, m))
for i in range(n):
    for j, s in enumerate(input()):
        if s == "#": a[i][j] = 1
for i in range(m):
    for j, s in enumerate(input()):
        if s == "#": b[i][j] = 1
for i in range(n - m + 1):
    for j in range(n - m + 1):
        sa = a[i:i+m, j:j+m]
        if not np.sum(np.logical_xor(sa, b)):
            print("Yes")
            exit()
print("No")


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	string s;
	cin >> s;
	bool ok =1;
	if(int(s.length())%2==1)ok=0;
	for(int i = 0; i < s.length(); i++){
		if((i%2==0&&s[i]=='h')||(i%2==1&&s[i]=='i')){
			
		}else ok = 0;
	}
	if(ok)cout << "Yes" << endl;
	else cout << "No" << endl;
}	


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
s = int(input())
i = 2
s_list = []
while True:
    s_list.append(s)
    if s % 2:
        s = 3*s + 1
    else:
        s /= 2
    if s in s_list:
        break
    i += 1

print(i)

Measured memory_bytes: 2940
N,A,B=map(int,input().split())
S=list(input())
pas=0
kai=0
for i in range(len(S)):
    if S[i]=='a':
        if pas<A+B:
            print('Yes')
            pas+=1
        else:
            print('No')
    elif S[i]=='b':
        kai+=1
        if pas<A+B and kai<=B:
            print('Yes')
            pas+=1
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 4712
package main

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

func main() {
	X := nextInt()

	fmt.Println(10 - X/200)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


Measured memory_bytes: 1804
/*#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a%2!=b%2) cout<<"IMPOSSIBLE"<<endl;
	else cout<<(a+b)/2<<endl;
}*/
/*#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int f[55];
	cin>>n;
	int num=0;
	for(int i=1;i<=n;i++)
	{
		cin>>f[i];
		if(f[i]!=i) num++;
	}
	if(num<=2) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}*/
/*#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int f[100010];
	int a[100010];
	for(int i=1;i<=n+1;i++) cin>>f[i];
	for(int i=1;i<=n;i++) cin>>a[i];
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=f[i]) ans+=(long long)f[i],a[i]-=f[i],f[i]=0;
		else ans+=(long long)a[i],f[i]-=a[i],a[i]=0;
		if(a[i]>=f[i+1]) ans+=(long long)f[i+1],a[i]-=f[i+1],f[i+1]=0;
		else ans+=(long long)a[i],f[i+1]-=a[i],a[i]=0;
	}
	cout<<ans<<endl;
}*/
#include<bits/stdc++.h>
#define p 1000000007
using namespace std;
long long f[100010][15];
long long mod[100010];
int main()
{
	string s;
	cin>>s;
	memset(mod,0,sizeof(mod));
	memset(f,0,sizeof(f));
	mod[0]=1;
	for(int i=1;i<=100000;i++)
	mod[i]=mod[i-1]*10%13;
	if(s[0]=='?')
	{
		for(int i=0;i<=9;i++)
		f[0][(i*mod[s.length()-1])%13]=1;
	}
	else f[0][(s[0]-'0')*mod[s.length()-1]%13]=1;
	for(int i=1;i<s.length();i++)
	{
		if(s[i]!='?')
		for(int j=0;j<13;j++)
		f[i][j]=f[i-1][(j+13-(s[i]-'0')*mod[s.length()-i-1]%13)%13],f[i][j]%=p;
		else
		for(int j=0;j<=9;j++)
		for(int k=0;k<13;k++)
		f[i][k]+=f[i-1][(k+13-j*mod[s.length()-i-1]%13)%13],f[i][k]%=p;
	}
	cout<<f[s.length()-1][5];
}

Measured memory_bytes: 13056
import java.util.Scanner;
public class Main {
	Scanner sc = new Scanner(System.in);
	int kode,mai,a;
	int[] kin ={6000,4000,3000,2000};
	int[] gou = new int[4];
	
	public void keisan(){
		for(a=0;a<=3;a++){
			kode = sc.nextInt();
			mai = sc.nextInt();
			switch(kode){
			case 1:
				gou[a] += kin[kode - 1] * mai; break;
			case 2:	
				gou[a] += kin[kode - 1] * mai; break;
			case 3:
				gou[a] += kin[kode - 1] * mai; break;
			case 4:	
				gou[a] += kin[kode - 1] * mai; break;
			}
		}
	}
	
	public void hyouji(){
		for(a=0;a<=3;a++){
			System.out.println(gou[a]);
		}	
	}
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Main go = new Main();
		go.keisan();
		go.hyouji();
		
	}

}

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

typedef long long int ll;
typedef long double ld;

#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define pll pair<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vpll vector<pll>
#define F first
#define S second
#define pb push_back
#define mp make_pair

bool isvowel(char c){
    return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';
}

int main()
{
    char c;cin>>c;
    if(isvowel(c)) cout<<"vowel";
    else cout<<"consonant";
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

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

bool solve(string s) {
  vector<int> cnt;
  cnt.assign(26, 0);

  for(char c : s) {
    cnt[c - 'a']++;
    if(cnt[c - 'a'] > 1) return false;
  }
  return true;
}

int main() {
  string s;
  cin >> s;

  if(solve(s)) cout << "yes" << endl;
  else cout << "no" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long N, std::vector<long long> A){
  sort(A.begin(), A.end());
  bool is_YES = true;
  for (int i = 0; i < N-1; ++i) {
    is_YES &= A[i] != A[i+1];
  }
  if (is_YES) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
}

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


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	int r, d, x;
	cin >> r >> d >> x;
	for (int i = 0; i < 10; i++) {
		x = r * x - d;
		cout << x << endl;
	}


}


Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <map>
#include <string>
#include <cstring>
#define fir first
#define sec second
using namespace std;

int n;
string s;

int main() {
    cin>>s;
    n = s.size();
    int flag = 0;
    for(int i=0;i<n/2;i++) {
        if(s[i] != s[n/2-1-i]) flag = 1;
        if(s[i] != s[n-i-1]) flag = 1; 
    }
    if(flag) printf("No\n");
    else printf("Yes\n");
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=1e5+10;
const int maxt=(1<<16)+10;
int val[maxn];
int cnt[20];
vector<int> g[maxn];
int n,ans,hmsk;
int dp[maxt];
bool ok[maxt];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int a,b,e;
		scanf("%d%d%d",&a,&b,&e);
		g[a].push_back(b);
		g[b].push_back(a);
		val[a]^=e;
		val[b]^=e;
	}
	for(int i=0;i<n;i++)
	{
		if(!val[i])continue;
		cnt[val[i]]^=1;
		if(cnt[val[i]]==0)ans++;
	}
	for(int i=0;i<16;i++)
		if(cnt[i])hmsk|=(1<<i),ans++;
	for(int msk=0;msk<(1<<16);msk++)
	{
		int val=0;
		for(int i=0;i<16;i++)
		{
			if(msk>>i&1)val^=i;
		}
		if(val==0)ok[msk]=1;
	}
	for(int msk=0;msk<(1<<16);msk+=2)
	{
		for(int s=msk;s;s=(s-1)&msk)
		{
			if(!ok[s])continue;
			dp[msk]=max(dp[msk],dp[msk^s]+1);
		}
	}
	printf("%d\n",ans-dp[hmsk]);
	return 0;
}

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

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

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {
	int N; cin >> N;
	string S;
	int AC = 0, WA = 0, TLE = 0, RE = 0;
	rep(i, N) {
		cin >> S;
		if (S == "AC") AC++;
		if (S == "WA") WA++;
		if (S == "TLE") TLE++;
		if (S == "RE") RE++;
	}

	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;

	return 0;
}

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

int main() {
   int X;
   cin >> X;
   bool finished=false;
   for (int i=0; i<200; i++) {
       for (int j=-200; j<200; j++) {
           long long A=i,B=j;
           for (int k=0; k<4; k++) {
               A*=i;
               B*=j;
           }
           if (X==A-B) {
               cout << i << " " << j << endl;
               finished=true;break;
           }
       }
       if(finished) break;
   }
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

bool solve(string &s, string &t, string &u){
  // s?????????????§??????????u????????????
  int is=0, it=0;
  rep(i,u.size()){
    if(i%2==0){
      while(is < s.size() && s[is]!=u[i]) is++;
      if(is == s.size()) return false;
      is++;
    } else {
      while(it < t.size() && t[it]!=u[i]) it++;
      if(it == t.size()) return false;
      it++;
    }
  }
  return true;
}

int main(){
  string s,t;
  cin>>s>>t;

  if(solve(s,t,s) || solve(t,s,s)) cout<<"Yes"<<endl;
  else cout << "No"<<endl;

  return 0;
}

Measured memory_bytes: 3224
#include <math.h>
#include <ctype.h>
#include <limits.h>
#include <string.h>
#include <assert.h>

#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>

#define nl                std::cout << "\n"
#define in(x)             std::cin  >> (x)
#define out(x)            std::cout << (x) << " "
#define err(x)            std::cerr << "DBG: " << #x << " " << (x) << "\n"

#define inn(x)            int x; in(x)
#define rep(i, n)         for (int i =  0 ; i < (n); ++i)
#define repr(i, l, r)     for (int i = (l); i < (r); ++i)
#define rrep(i, n)        for (int i = (n) - 1; i > -1; --i)

#define no                puts("NO")
#define yes               puts("YES")

using ll  = long long int;
using vi  = std::vector<int>;
using ii  = std::pair<int, int>;
using iii = std::pair<ii, int>;
using vii = std::vector<ii>;

const int N = 1010101;
const int MD = 1e9 + 7;

void solve() {
    std::string s; in(s);
    rep(i, 3) {
        if (s[i] == s[i + 1]) {
            puts("Bad");return;
        }
    }
    puts("Good");
}

int main() {
    std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

    //int t; in(t); repr(tc, 1, t + 1)
    solve();

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner scan = new Scanner(System.in);
		int h = scan.nextInt();
		int n = scan.nextInt();
		List<Integer> list1 = new ArrayList<Integer>();
		List<Integer> list2 = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list1.add(scan.nextInt());
			list2.add(scan.nextInt());
		}

		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		map.put(0, 0);
		int current = 1;
		int result = Integer.MAX_VALUE;
		while (current <= h + Collections.max(list1)) {
			int min = Integer.MAX_VALUE;
			for (int i = 0; i < n; i++) {
				int a = list1.get(i);
				int b = list2.get(i);
				int key = current - a;
				if (map.containsKey(key)) {
					min = Math.min(map.get(key) + b, min);
				}
			}

			if (min < Integer.MAX_VALUE) {
				map.put(current, min);
				if (current >= h) {
					result = Math.min(min, result);
				}
			}

			current++;
		}

		System.out.println(result);
		scan.close();
	}
}

Measured memory_bytes: 117372