akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;

int main() {
	string S;
	cin >> S;
	int A = 0, B = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '0') A++;
		else B++;
	}
	cout << min(A, B) * 2 << endl;
}

Measured memory_bytes: 512
from collections import defaultdict
h, w, m = map(int, input().split())
hw = [tuple(map(int, input().split())) for _ in range(m)]
tate, yoko = defaultdict(int), defaultdict(int)
for h, w in hw:
    tate[h] += 1
    yoko[w] += 1
tate = sorted(tate.items(), key=lambda x:x[1], reverse=True)
yoko = sorted(yoko.items(), key=lambda x:x[1], reverse=True)
tate_max, yoko_max = tate[0][1], yoko[0][1]
max_tates, max_yokos = [], []
for t in tate:
    if t[1] == tate_max:
        max_tates.append(t)
    else:
        break
for y in yoko:
    if y[1] == yoko_max:
        max_yokos.append(y)
    else:
        break

hw = set(hw)
for ta in max_tates:
    for yo in max_yokos:
        if (ta[0], yo[0]) not in hw:
            print(tate_max + yoko_max)
            exit()
print(tate_max + yoko_max - 1)

Measured memory_bytes: 241056
from functools import lru_cache

n, a, b, c = map(int, input().split())
_l = [int(input()) for i in range(n)]

inf = 10**9


# DP
@lru_cache(maxsize=10000)
def f(i, _a, _b, _c):
    # A,B,Cにしようとしている枝の長さが現在_a,_b,_cのとき,i番目以降の材料を使って達成される点数の最小値
    if i == n:
        return abs(a - _a) + abs(b - _b) + abs(c - _c) if min(_a, _b, _c) > 0 else inf

    # i番目を使わないとき
    val1 = f(i + 1, _a, _b, _c)
    # i番目をAに使うとき
    val2 = f(i + 1, _a + _l[i], _b, _c) + (0 if _a == 0 else 10)
    val3 = f(i + 1, _a, _b + _l[i], _c) + (0 if _b == 0 else 10)
    val4 = f(i + 1, _a, _b, _c + _l[i]) + (0 if _c == 0 else 10)
    return min(val1, val2, val3, val4)


print(f(0, 0, 0, 0))


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    string x;cin >> x;
    lint ans = SZ(x);
    lint s = 0;
    REP(i,SZ(x)){
        if(x[i]=='S')
        {
            s++;
        }else{
            if(s>0){
                s--;
                ans -= 2;
            }
        }
    }

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 832
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cmath>
using namespace std;
struct point
{
	double x, y;
}pos[105];
bool cmp(point a, point b)
{
	return atan2(a.y, a.x) < atan2(b.y, b.x);
}
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> pos[i].x >> pos[i].y;
	sort(pos, pos + n, cmp);
	long long ans = 0;
	for (int i = 0; i < n; i++)
	{
		long long x = 0, y = 0;
		for (int j = 0; j < n; j++)	//注意可能构成环的情况
		{
			x += pos[(i + j) % n].x, y += pos[(i + j) % n].y;
			ans = max(ans, x * x + y * y);
		}
	}
	cout << fixed << setprecision(20) << sqrt(ans) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
#define maxn 30
char a[maxn][maxn][5];
int main()
{
	int h, w;
	cin >> h >> w;
	
	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			scanf("%s",a[i][j]);
			if (strcmp("snuke", a[i][j]) == 0)
			{
				printf("%c%d\n", j - 1 + 'A', i); break;
			}
				

		}
	}
	


	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;

    double ans = 0.0;
    for(int i=1; i<=n; ++i){
        int a = i;
        double p = 1.0 / n;
        while(a < k){
            a *= 2;
            p /= 2.0;
        }
        ans += p;
    }
    printf("%.10f\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define pb push_back
#define vl vector
#define ff first
#define ss second
using namespace std;
int main()
{
    ll a,b,i,j,n,t,c;
    cin>>a>>b>>c;
    ll flag=0;
    if(a%b) flag=1;
    a=a/b;
    if(flag==1) a++;
    cout<<a*c;
}

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

int main(){
	int a,b;
	string op;
	cin >> a >> op >> b;
	while(op != "?"){
		if (op == "+"){
			cout << a+b << endl;
		}else if(op == "-"){
			cout << a-b << endl;
		}else if(op == "*"){
			cout << a*b << endl;
		}else if(op == "/"){
			cout << a/b << endl;
		}
		cin >> a >> op >> b;
	}
}

Measured memory_bytes: 1208
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)

	ps := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&ps[i])
	}

	sort.Ints(ps)
	ps[len(ps)-1] /= 2

	sum := 0
	for i := 0; i < N; i++ {
		sum += ps[i]
	}

	fmt.Println(sum)
}


Measured memory_bytes: 1840
def gcd(a, b):
  while b:
    a, b = b, a%b
  return a

def run():
  N, K = map(int, input().split())
  A_li = list(map(int, input().split()))
  if K > max(A_li):
    print('IMPOSSIBLE')
    exit()
  factor = A_li[0]
  for A in A_li[1:]:
    factor = gcd(factor, A)
  if K%factor != 0:
    print('IMPOSSIBLE')
    exit()
  print('POSSIBLE')
  
if __name__ == '__main__':
  run()

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<string> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());

    int count =1;
    for(int i=0; i<N-1; i++){
        if(vec.at(i) != vec.at(i+1) ){
            count++;
        }
    }
    cout << count << endl;
}

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

#define REP( i, n) for( int i = 0; i < (n); ++i)
#define FOR( i, a, b) for( int i = (a); i < (b); ++i)

#define pb push_back

const int INF = 100100100;
const int MOD = (int)1e9 + 7;

using ll = long long;

using namespace std;

int main(){
  int n,k;
  int ans = 1;

  cin >> n >> k;
  REP( i, n){
    if( ans < k ){
      ans += ans;
    }else{
      ans += k;
    }
  }

  cout << ans << endl;


}


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

using namespace std;

typedef long long ll;

const int MAX_N = 3030;

int N;
ll P, F[MAX_N][MAX_N], fac[MAX_N], ifac[MAX_N], pof2[MAX_N * MAX_N];

ll sq(ll x, ll p = P) { return x * x % p; }
ll qpow(ll a, ll b, ll p = P) { return b ? sq(qpow(a, b / 2, p), p) * (b & 1 ? a : 1) % p : 1; }
ll inv(ll x) { return qpow(x, P - 2); }
ll comb(int n, int m) { return fac[n] * ifac[n - m] % P * ifac[m] % P; }

int main() {
    scanf("%d%lld", &N, &P);
    for (int i = 0; i <= N; i++) {
        F[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            F[i][j] = ((j + 1) * F[i - 1][j]  + F[i - 1][j - 1]) % P;
        }
    }
    fac[0] = 1;
    for (int i = 1; i <= N; i++) fac[i] = fac[i - 1] * i % P;
    ifac[N] = inv(fac[N]);
    for (int i = N; i; i--) ifac[i - 1] = ifac[i] * i % P;
    pof2[0] = 1;
    for (int i = 1; i <= N * N; i++) pof2[i] = pof2[i - 1] * 2 % P;
    ll ans = 0;
    for (int i = 0; i <= N; i++) {
        ll coe = (i & 1 ? P - 1 : 1) * comb(N, i) % P * qpow(2, qpow(2, N - i, P - 1)) % P, t = 0;
        for (int j = 0; j <= i; j++) {
            (t += pof2[j * (N - i)] * F[i][j]) %= P;
        }
        (ans += coe * t) %= P;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 143616
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstdint>

using namespace std;

int main() {
    int x, y;
    scanf("%d %d", &x, &y);

    int res=0;
    if (x+y == 0)
        return !printf("1\n");

    if (x == y)
        return !printf("0\n");

    if (y < 0) {
        if (x < y) {
            res = y-x;
        } else if (x < 0) {
            res = 2+x-y;
        } else if (x < -y) {
            res = 1-x-y;
        } else {
            res = 1+x+y;
        }
    } else if (y > 0) {
        if (x < -y) {
            res = 1-y-x;
        } else if (x < 0) {
            res = 1+y+x;
        } else if (x < y) {
            res = y-x;
        } else {
            res = 2+x-y;
        }
    } else {
        if (x < 0) {
            res = -x;
        } else {
            res = x+1;
        }
    }        

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


Measured memory_bytes: 128
a, b, c, d, e, f = STDIN.gets.split.map(&:to_i)

max_water = 0
max_sugar = 0
max_concentrate = 0.0
(0..(f / (a * 100))).each do |wcount1|
  (0..(f / (b * 100))).each do |wcount2|
    next if wcount1 == 0 && wcount2 == 0
    water = wcount1 * a * 100 + wcount2 * b * 100
    sugar_limit = (wcount1 * a + wcount2 * b) * e
    (0..((f - water) / c)).each do |scount1|
      (0..((f - water - c * scount1) / d)).each do |scount2|
        sugar = scount1 * c + scount2 * d
        next if sugar > sugar_limit
        next if sugar + water > f
        next if sugar == 0 || water == 0
        concentrate = sugar.to_f / (sugar + water)
        if concentrate > max_concentrate
          max_concentrate = concentrate
          max_water = water
          max_sugar = sugar
        end
      end
    end
  end
end

if max_water == 0 && max_sugar == 0
  max_water = a * 100
end

puts "#{max_sugar + max_water} #{max_sugar}"


Measured memory_bytes: 1788
import statistics
n = int(input())
x = list(map(int,input().split()))

median_left = statistics.median_low(x)
median_right = statistics.median_high(x)

for i in range(n):
  if x[i] == median_right:
    print(median_left)
  elif x[i] == median_left:
    print(median_right)
  else:
    if x[i] < median_left:
      print(median_right)
    else:
      print(median_left)
  

Measured memory_bytes: 27296
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
int abs_(int a){
  return max(a,-a);
}
int main(){
  int n;
  cin>>n;
  int rsum[105]={0};
  for(int i=1;i<=n;i++){
    int a;
    cin>>a;
    rsum[i]=rsum[i-1]+a;
  }
  int ans=1000007;
  for(int i=0;i<=n;i++){
    ans=min(ans,abs_(rsum[i]-(rsum[n]-rsum[i])));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long T;
  T=1;
  while(T--)
  {
     long long n,k;
     cin>>n>>k;
     long long m=n%k;
     cout<<min(m,abs(k-m))<<endl;
  }
   return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int N = S.Length;
		int ord = 0;
		var l = new LinkedList<char>();
		foreach(var c in S){
			l.AddLast(c);
		}
		
		for(int q=0;q<Q;q++){
			var ss = rsa();
			switch(ss[0][0]){
				case '1':{
					ord ^= 1;
					} break;
				case '2':{
					if(ord == 0){
						if(ss[1][0] == '1'){
							l.AddFirst(ss[2][0]);
						} else {
							l.AddLast(ss[2][0]);
						}
					} else {
						if(ss[1][0] == '1'){
							l.AddLast(ss[2][0]);
						} else {
							l.AddFirst(ss[2][0]);
						}
					}
				} break;
			}
		}
		if(ord == 0){
			Console.WriteLine(new String(l.ToArray()));
		} else {
			var ll = l.ToArray();
			Array.Reverse(ll);
			Console.WriteLine(new String(ll));
		}
	}
	String S;
	int Q;
	public Sol(){
		S = rs();
		Q = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 35620
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int n, a[100000];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	rep(i, n)cin >> a[i], a[i]--;
	int ans = 0;
	rep(i,n) {
		if (i == a[a[i]])ans++;
	}
	cout << ans / 2 << endl;
	return 0;
}

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

int main(){
  int n,x,y;
  cin>>n>>x>>y;
  int a[n];
  int b[n];
  int c[n];
  rep(i,0,n){
    cin>>a[i]>>b[i]>>c[i];
  }
  P before[1<<(n/2)];
  rep(i,0,1<<(n/2)){
    int d=0;
    int e=0;
    int f=0;
    rep(j,0,n/2){
      if(1 & i>>j){
        d+=a[j];
        e+=b[j];
        f+=c[j];
      }
    }
    before[i]=P(e*x-d*y,f);
  }
  sort(before,before+(1<<(n/2)));
  
  int ans=114514;
  rep(i,0,1<<(n-n/2)){
    int d=0;
    int e=0;
    int f=0;
    rep(j,0,n-n/2){
      if(1 & i>>j){
        d+=a[n/2+j];
        e+=b[n/2+j];
        f+=c[n/2+j];
      }
    }
    if(f!=0){
      int g=lower_bound(before,before+(1<<(n/2)),P(d*y-e*x,0))-before;
      if(g!=1<<(n/2) && before[g].first==d*y-e*x){
        ans=min(ans,f+before[g].second);
      }
    }
    else{
      int g=upper_bound(before,before+(1<<(n/2)),P(d*y-e*x,0))-before;
      if(g!=1<<(n/2) && before[g].first==d*y-e*x){
        ans=min(ans,f+before[g].second);
      }
    }
  }
  if(ans==114514){
    cout<<-1<<endl;
  }
  else{
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A=1;
  cin >> N;
  
  vector<int> a(N);
  for(int i=0;i<N;i++) cin >> a.at(i);
  
  sort(a.begin(),a.end());
  
  for(int i=0;i<N-1;i++) if(a.at(i)!=a.at(i+1))A++;
        
  cout << A << endl;
  
}

Measured memory_bytes: 256
sh = ["#" for i in range(20)]
def  bet():
    for i in sh:
        print(i, end="")
    print()

one = [[0 for i in range(10)] for j in range(3)]
two = [[0 for i in range(10)] for j in range(3)]
three = [[0 for i in range(10)] for j in range(3)]
four = [[0 for i in range(10)] for j in range(3)]


n = int(input())
for i in range(n):
    line = input()
    lst = list(map(int, line.split()))
    b = lst[0]
    f = lst[1]
    r = lst[2]
    v = lst[3]
    if b == 1:
        one[f-1][r-1] += v
    elif b == 2:
        two[f-1][r-1] += v
    elif b == 3:
        three[f-1][r-1] += v
    elif b == 4:
        four[f-1][r-1] += v
"""
print(one)
print(two)
print(three)
print(four)

"""
for i in one:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in two:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in three:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in four:
    for j in i:
        print(" {}".format(j), end="")
    print()

#print(one)


Measured memory_bytes: 5644
use std::io;
use std::io::Read;

fn main() {
    let mut stdin = io::stdin();
    let mut lines = String::new();
    let _ = stdin.read_to_string(&mut lines);
    let vec = lines.lines().collect::<Vec<&str>>();
    let vec2 = vec[0].split(' ').collect::<Vec<&str>>();
    let n :usize = vec2[0].trim().parse().unwrap();
    let m :usize = vec2[1].trim().parse().unwrap();
    let answer = if n > m/2 {
        m/2
    } else {
        n + (m - 2*n) / 4
    };
    println!("{}",answer);
}


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

using namespace std;

typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}
char black = '0';
int white = '1';

int main(void){
    string sWhite;
    cin >> sWhite;
    string tBlack = sWhite;
    int fBlack, fWhite;
    if(sWhite[0] == white){
        fWhite = 0;
        fBlack = 1;
        tBlack[0] = black;
    }else{
        fWhite = 1;
        fBlack = 0;
        sWhite[0] = white;
    }
    int len = sWhite.length();
    for(int i = 1; i < len; i++){
        if(sWhite[i] == sWhite[i-1]){
            if(sWhite[i] == white){
                sWhite[i] = black;
            }else{
                sWhite[i] = white;
            }
            fWhite++;
        }
        if(tBlack[i] == tBlack[i-1]){
            if(tBlack[i] == white){
                tBlack[i] = black;
            }else{
                tBlack[i] = white;
            }
            fBlack++;
        }
    }
    cout << min(fWhite, fBlack) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main( ){
int n,rev=0,d=0,p;

scanf("%d",&n);
p=n;
while(n!=0)
{
	d=n%10;
	rev=(rev* 10)+d;
	n=n/10;
	}
	if(p==rev){
	
	printf("Yes");
	}
	else
	{
		printf("No");
	}
		
}

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

int main(){
  int N; string S;
  cin >> N >> S;

  for(int i=0; i<S.length(); i++){
    S[i] = 'A'+ (S[i] - 'A' + N) % 26;
  }

  cout << S << endl;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
               #sc = [[1, 7], [3, 2], [1, 7]]
tmp = []
if n == 1:
    tmp.append(0)
for i in range(10**(n-1), 10**n):
    tmp.append(i)
 
ans = -1
for i in tmp:
    l = list(map(int, list(str(i))))
    if all(l[s-1] == c for s,c in sc):   #上の例で考えるとsは1、cは7が格納される
        ans = i
        break
print(ans)

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

    cout << (n < 1000? "ABC":"ABD") <<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int a,b; cin >> a >> b;
	rep(i, max(a, b)) {
		cout << min(a, b);
		if (i == max(a, b) - 1)cout << "\n";
	}

	return 0;
}


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

using namespace std ;

int n , q ;
int counter[200001];
vector<int>graph[200001];

void dfs(int v , int parent , int cnt ){
        for(int i: graph[v] ){
                if(i!=parent){
                        dfs(i,v,cnt+counter[i]);
                }
        }
        counter[v] = cnt;
}

int32_t main(){
        ios_base::sync_with_stdio(0); cin.tie(0);

        cin >> n >> q ; 
        memset(counter,0,sizeof(counter));
        for(int i = 0 ; i < n-1 ; i++ ){
                int a, b ; cin >> a >> b ; 
                a--;b--; graph[a].emplace_back(b) ; 
                graph[b].emplace_back(a);
        }

        for(int i=0;i<q;i++){
                int a , x ; cin >> a >> x ;
                a--; counter[a] += x ;
        }

        dfs(0,-1,counter[0]);

        for(int i=0;i<n;i++)
                cout << counter[i] << ' ';
        cout << endl;
        
        return 0;
        
}

Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,c,a=0,j;
    cin>>n;
    for(i=1;i<=n;i+=2)
    {
        c=0;
        for(j=1;j<=i;j++)
        {
            if(i%j==0)
                c++;
        }
        if(c==8)
            a++;
    }
    cout<<a<<endl;
}


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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

const unsigned int M = 1e9 + 7;

int32_t main() {
	fastio;

	int x, y;
	cin >> x >> y;
	bool ok = false;
	for(int i = 0; i <= x; ++i) {
		if((2 * i + 4 * (x - i)) == y) {
			ok = true;
			break;
		}
	}
	cout << (ok ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;
import java.util.Arrays;
import java.lang.Math;

class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                int n = scan.nextInt();
                int m = scan.nextInt();
                int[] c = new int[m];
                for(int i=0; i<m; i++){
                        c[i] = scan.nextInt();
                }
                Arrays.sort(c);

                // (1) ??¬??¨???????????????????????????
                int T[][] = new int[m][n+1];

                // (2) T[0][n]=n??§?????????
                for(int i=0; i<n+1; i++){
                        T[0][i] = i;
                }

                // (3) ????????????????????´??°?????????
                // T[i][j] = Math.min(T[i-1][j], T[i][j-c[i]]+1)
                for(int i=1; i<m; i++){
                        for(int j=0; j<n+1; j++){
                                if (j-c[i] < 0)
                                {
                                        T[i][j] = T[i-1][j];
                                }else{
                                        T[i][j] = Math.min(T[i-1][j], T[i][j-c[i]]+1);
                                }
                        }
                }

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

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

void print(vector<int> v) {
        for ( int k = 0; k < v.size(); k++ ) {
            cout << (k==0 ? "" : " ") << v[k];
        }
        cout << '\n';
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    print(A);
    int v,j;
    for ( int i = 1; i < N; i++ ) {
        v = A[i];
        j = i - 1;
        while ( j >= 0 && A[j] > v ) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        print(A);
    }
    return 0;
}


Measured memory_bytes: 3140
import std;
void main(){
  auto input=readln.chomp.split.to!(size_t[]);
  auto x=input[0];
  auto y=input[1];
  
  auto b_2=y-2*x;
  if(b_2%2!=0){
    "No".writeln;
    return;
  }
  auto b=b_2/2;
  if(x<b){
    "No".writeln;
    return;
  }
  "Yes".writeln;
}

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

int main() {
    string s; cin >> s;
    for (char c = 'a'; c <= 'z'; c++) {
        if (s.find(c) == s.npos) return !(cout << c << endl);
    }
    cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 512
n = int(input())
a = [int(i) for i in input().split(' ')]

color = a[0]
cnt = 1
magic = 0
for slime in a[1:]:
    if slime == color:
        cnt += 1
    else:
        color = slime
        magic = magic + cnt //2
        cnt = 1

if cnt > 1:
    magic = magic + cnt //2
    
print(magic)
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

//状態 j : 10100...11 : 2進表記で 1 が opened, 0 が locked
//鍵 i までを使って 状態 j にするときの最小コスト

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

    ll n, m;
    cin >> n >> m;
    ll inf = 1e12;
    vvll dp(m + 1, vll(1 << n, inf));
    dp[0][0] = 0;
    ll a, b;
    REP(i, m){
        cin >> a >> b;
        ll op = 0, c;
        while(b){
            cin >> c;
            op |= (1 << (c - 1));
            b--;
        }
        REP(j, 1 << n){
            //鍵 i + 1 を使わない場合
            dp[i + 1][j] = dp[i][j];
        }
        REP(j, 1 << n){
            //状態 j | op への推移:状態 j から鍵 i + 1 を使う OR 状態 j | op から鍵 i + 1 を使わない
            dp[i + 1][j | op] = min(dp[i][j] + a, dp[i + 1][j | op]);
        }
    }
    ll res = dp[m][(1 << n) - 1];
    if(res == inf) cout << -1 << endl;
    else cout << res << endl;
    return 0;
}

Measured memory_bytes: 32384
s = [x for x in input()]
t = [x for x in input()]
s.sort()
t.sort(reverse=True)
s, t = "".join(s), "".join(t)
ans = "No"
m = min(len(s), len(t))
for i in range(m):
    if s[i] < t[i]:
        ans = "Yes"
        break
if ans == "No" and s[:m] == t[:m] and len(s) < len(t): ans = "Yes"
print(ans)


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


public class Main {


	public static void main(String[] args) throws Exception{
		BufferedReader  jk =  new BufferedReader(new InputStreamReader( System.in))  ; 
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)) ; 
		StringTokenizer ana = new StringTokenizer(jk.readLine()) ;
		int n = Integer.parseInt(ana.nextToken()) ; 
		int t[]= new int[n] ; 
		ana = new StringTokenizer(jk.readLine()) ;
		for(int i=0 ; i<n ;i++)
		{
			t[i]= Integer.parseInt(ana.nextToken()) ; 
		}
		int cost[]=new int[n] ; 
		cost[0]=0 ; cost[1]= Math.abs(t[1]-t[0]) ; 
		for(int i=2 ;i<n ;i++)
		{
			int y1 = cost[i-1]+Math.abs(t[i]-t[i-1]) ; 
			int y2 = cost[i-2]+ Math.abs(t[i]-t[i-2]) ; 
			cost[i] =Integer.min(y1, y2)  ;
		}
		out.println(cost[n-1]);
		














		out.flush();
	}
}



Measured memory_bytes: 31136
N=int(input())

h=list(map(int,input().split()))
sw=True
temp=0
ans=0
for i in range(N-1):
    if sw==True:
        if h[i]>h[i+1]:
            ans+=h[i]-temp
            sw=False
    else:
        if h[i]<h[i+1]:
            temp=h[i]
            sw=True
if sw==True:
    ans+=h[N-1]-temp

print(ans)


Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
#define ld long double
typedef pair<ll,ll> pii;
const int maxn=200005;
const int mod=1e9+7;
ll qp(ll a,ll b)
{
    ll ret=1;
    while(b)
    {
        if(b&1) ret=ret*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return ret;
}
ll jc[maxn],inv[maxn];
void init()
{
    jc[0]=1;
    for(int i=1;i<=200004;i++) jc[i]=jc[i-1]*i%mod;
    inv[200004]=qp(jc[200004],mod-2);
    for(int i=200003;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
}
ll C(int x,int y)
{
    return jc[x]*inv[x-y]%mod*inv[y]%mod;
}
ll calc(int x,int y)
{
    return C(x+y-2,x-1);
}
int main()
{
    #ifdef local
    freopen("in.txt","r",stdin);
    #endif // local
    IOS;
    init();
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    ll ans=0;
    for(int i=h-a+1;i<=h;i++)
    {
        ans+=calc(i,b)*calc(h-i+1,w-b)%mod;
        ans%=mod;
    }
    ans=calc(h,w)-ans;
    ans=(ans+mod)%mod;
    cout<<ans<<endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int read(){
	char c=getchar();int f=1,sum=0;
	while(c>'9' or c<'0') if(c=='-'){f=-1;c=getchar();}
	while(c<='9' and c>='0'){sum=sum*10+c-'0';c=getchar();}
	return sum*f;
}
int main(){
	char a,b;
	cin>>a>>b;
	if (a==b) cout<<'='<<endl;
	else if (a<b) cout<<"<"<<endl;
	else cout<<">"<<endl;


	return 0;
}


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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
#define sbp(p, n) rep(i, n) { int a, b; scanf("%d %d", &a, &b); p[i] = make_pair(a, b); }
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	int n, r, b;
	char s[101];
	cin >> n >> s;
	rep(i, n){
		if(s[i] == 'R') r++;
		if(s[i] == 'B') b++;
	}
	if(r > b) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

#define N 1000

int main(){
  int A[N];
  int a,b;
  int i,count=0;
 char T[N];
 char P[N];
  scanf("%s %s",T, P);

  a = strlen(T);
  b = strlen(P);
  for(i = 0;i < a; i++){
    if(strncmp(T+i,P,b) == 0){
      A[count] = i;
      count++;
    }

  }
  for( i = 0; i < count; i++){
    printf("%d\n" , A[i]);
  }
  return 0;
}

Measured memory_bytes: 564
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <complex>
using namespace std;



#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

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

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const double EPS = 1e-8;
const int MOD = 1000 * 1000 * 1000 + 7;
const int MAX = 5*1000 * 100 + 47;
const int LEN = 20;
const int ALP = 128;



int n;
VI G[MAX];
int X[MAX];
int U[MAX];
int iter;
int H;


void DFS(int v, int h = 0) {
    H = max(H, h);
    U[v] = iter;
    int deg = 0;
    FOR(i, 0, SZ(G[v])) {
        int to = G[v][i];
        if (U[to] == iter)continue;
        deg++;
        DFS(to, h+1);
    }
    X[h] = max(X[h], deg);
}

LL calc() {
    LL res = 1LL;
    FOR(i, 0, n)res *= max(1, X[i]);
    return res;
}

int A[MAX], B[MAX];

int main(){
    scanf("%d", &n);
    FOR(i, 0, n-1) {
        int a, b;
        scanf("%d%d", &a, &b);
        --a, --b;
        G[a].PB(b);
        G[b].PB(a);
        A[i] = a, B[i] = b;
    }
    pair<LL, LL> ANS = MP(LINF, LINF);
    FOR(i, 0, n) {
        H = 0;
        memset(X, 0, n * sizeof(int));
        ++iter;
        DFS(i);
        //cout << H + 1 << " " << calc() << endl;
        ANS = min(ANS, MP(H+1LL, calc()));
    }
    
    //cout << ANS.first << " " << ANS.second << endl;
    //cout << "**" << endl;
    FOR(i, 0, n-1) {
        H = 0;
        memset(X, 0, n * sizeof(int));
        ++iter;
        U[A[i]] = U[B[i]] = iter;
        DFS(A[i]), DFS(B[i]);
       // cout << H + 1 << " " << calc() * 2 << endl;
        ANS = min(ANS, MP(H+1LL, calc() * 2));
    }
    
    cout << ANS.first << " " << ANS.second << endl;
    //    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 17792
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] L = new int[N];
    for (int i = 0; i < N; i++) {
      L[i] = sc.nextInt();
    }
    Arrays.sort(L);
    int ans = 0;
    for (int i = 0; i < N - 2; i++) {
      int a = L[i];
      for (int j = i + 1; j < N - 1; j++) {
        int b = L[j];
        int l = j + 1, r = N - 1;
        while (l + 1 < r) {
          int m = (l + r) / 2;
          if (L[m] < a + b) {
            l = m;
          } else {
            r = m;
          }
        }
        int c1 = L[l];
        int c2 = L[r];
        if (c2 < a + b) {
          ans += r - j;
        } else if (c1 < a + b){
          ans += l - j;
        }
      }
    }
    System.out.println(ans);
  }
}

// nC3 = n! / ((n-3)!3!) = n * (n-1) * (n-2) / 6


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(ll i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> alis(n);
    REP(i, 0, n){cin >> alis[i];}
    REP(i, 0, min(k, 400LL)){
        vector<ll> imos(n, 0), up(n, 0), down(n, 0);
        ll count = 0;
        REP(l, 0, n){
            up[max(l-alis[l], 0LL)]++;
            down[min(l+alis[l], n-1)]++;
        }
        REP(l, 0, n){
            count += up[l];
            alis[l] = count;
            count -= down[l];
        }

    }
    REP(i, 0, n){
        cout << alis[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 9572
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const long long inf = 1LL << 22;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	if (s.at(5) == '1') {
		cout << "TBD" << endl; return 0;
	}
	else if (s.at(6) == '1' || s.at(6) == '2' || s.at(6) == '3' || s.at(6) == '4') {
		cout << "Heisei" << endl;
	}
	else {
		cout<<"TBD"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int a, b;
    string s;
    cin>>a>>b>>s;
    --a; --b;
    if (s[a + 1] != '-') cout<<"No"<<endl;
    else {
        bool found = false;
        int i = 0;
        while (i < s.length() && ! found) {
            if (!isdigit(s[i]) && i != a + 1) found = true;
            ++i;
        }
        cout<<(found ? "No" : "Yes")<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, a;
    cin>>n>>a;
    vl xs(n);
    cin>>xs;

    vvl dp(n + 1, vl(2600));
    dp[0][0] = 1;
    rep(i, n) rep(j, n) rep(k, 2550) {
        if (k + xs[i] < 2550) dp[n - j][k + xs[i]] += dp[n - j - 1][k];
    }
    ll ans = 0;
    rep(i, n) {
        ans += dp[i + 1][a * (i + 1)];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1280
#include<stdio.h>
#include<math.h>

long long n;

long long WS(long long);

int main(void){
	scanf("%lld",&n);
	for(int i=sqrt(n);i>=1;i--)
		if(n%i==0)
			return printf("%lld\n",WS(n/i)),0;
	return 0;
}

long long WS(long long num){
	long long sum=1;
	while(num>=10)
		sum++,
		num/=10;
	return sum;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using LL = long long;

int main(){
    LL n; 
    int k;
    cin >> n >> k;
    for(int i=0; i<31; i++){
        if(pow(k,i) <= n and n < pow(k,i+1)){
            cout << i+1 << endl;
        }
    }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    int n;
    cin>>n>>s;
    for(int i=0;i<s.size();i++){
        char c = s[i];
        if((int)c+n>90){
            c = 'A'+c+n-91;
        }
        else{
            c = c+n;
        }
        cout<<c;
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(v) for(int k=head[v];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=5e5+5,M=1e7+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
ll d[N],a,b,n;
il void ad(ll&a,ll b){a+=b;a%=mod;}
struct BIT{
	ll bit[N];
	vector<int>memo;
	void init(){re(i,0,memo.size())bit[memo[i]]=0;memo.clear();;}
	void add(int x,int y){x++;for(;x<=n+1;x+=x&(-x))ad(bit[x],y),memo.pb(x);}
	ll sum(int x){ll res=0;x++;for(;x;x-=x&(-x))ad(res,bit[x]);return res;}
}f,g;
int main(){
	read(n);read(a,b);
	rep(i,1,n)read(d[i]);
	f.add(0,1);g.add(0,1);
	int fp=0,gp=0;
	rep(i,2,n){
		while(fp+1<i&&d[i]-d[fp+1]>=a)fp++;
		while(gp+1<i&&d[i]-d[gp+1]>=b)gp++;
		int ff=g.sum(fp),gg=f.sum(gp);
		if(d[i]-d[i-1]<a)f.init();
		f.add(i-1,ff);
		if(d[i]-d[i-1]<b)g.init();
		g.add(i-1,gg);
	}
	ll res=f.sum(n-1);ad(res,g.sum(n-1));
	cout<<res<<endl;
}

Measured memory_bytes: 19424
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>


using namespace std;

typedef long long ll;

#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vld vector<ld>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define vvld vector<vector<ld>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const ll M = 1000000007;
const ll MM = 998244353;
const ll inf = INT_MAX;
ll begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
//#define _Find_next
//#define _Find_first

//#define trace(...)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

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

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



ll powM(ll a, ll b, ll m)
{
  if (a <= 0)return 0;
  a %= m;
  ll ans = 1LL;
  while (b)
  {
    if (b & 1)ans = ans * a % m;
    a = a * a % m;
    b >>= 1;
  }

  return ans;
}



ll poww(ll a, ll b)
{

  ll ans = 1;
  while (b)
  {
    if (b & 1)ans = ans * a;
    a = a * a;
    b >>= 1;
  }

  return ans;

}


string tostring(ll x) {
  stringstream sss;
  sss << x;
  string ans = sss.str();
  return ans;
}



const ll N = 1e6 + 5;




int main() {

  IOS;

#ifndef ONLINE_JUDGE

  freopen("input1.txt", "r", stdin);
  freopen("output1.txt", "w", stdout);

#endif


  ll n;
  cin >> n;

  ll ans = powM(10, n, M) + powM(8, n, M) - 2 * powM(9, n, M) % M;

  ans = (ans + 3 * M) % M;

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

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

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define ld long double
#define s second
#define vec vector<int>

using namespace std;

const int N = (int) 1e3 + 100;
const int M = (int) 1e5 + 100;
const int K = (int) 200;
const int INF = (int) 1e9 + 7;
const int mod = (int) 998244353;
const ld EPS = (ld) 1e-9;
const ll LINF = (ll) 1e18;

int n, m, k;
char a[N][N];
int d[N][N];

bool ok(pii x) {
	return x.f >= 1 && x.s >= 1 && x.f <= n && x.s <= m && a[x.f][x.s] != '#';
}

const int nx[4] = {1, -1, 0, 0};
const int ny[4] = {0, 0, 1, -1};	

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	srand(time(0));
	cin >> n >> m >> k;
	pii start;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> a[i][j];
			if (a[i][j] == 'S') {
				start = mp(i, j);
			}
		}
	}
	memset(d, -1, sizeof(d));
	queue<pii> q;
	d[start.f][start.s] = 0;
	q.push(start);
	while (!q.empty()) {
		pii fr = q.front();
		q.pop();
		for (int i = 0; i < 4; i++) {
			pii go = mp(fr.f + nx[i], fr.s + ny[i]);
			if (ok(go) && d[go.f][go.s] == -1) {
				d[go.f][go.s] = d[fr.f][fr.s] + 1;
				q.push(go);
			}
		}
	}
	int ans = INF;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (d[i][j] == -1)
				continue;
			int cost = (d[i][j] + k - 1) / k;
			int mn = min(i - 1, n - i);
			mn = min(mn, min(j - 1, m - j));
			cost += (mn + k - 1) / k;
			if (mp(i, j) == start) 
				++cost;
			ans = min(ans, cost);
		}	
	}
	cout << ans;
	return 0;		
}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>S;

    n = strlen(S);

    for(int i=0;i<(n+1)/2;i++)
        if(S[i]!=S[n-1-i])cnt++;

    cout<<cnt<<"\n";

    return 0;
}


Measured memory_bytes: 256