akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

#define TOP_NUM 17
#define NOTOP_NUM 9

int main(){
	IO_STREAM;
	int D;	cin>>D;
	vi c(26);
	vector<pair<int,int>>cs(26);
	rep(i,0,26){
		cin>>c[i];
		cs[i].first=c[i];
		cs[i].second=i;
	}
	int s[D][26];
	rep(i,0,D){
		rep(j,0,26){
			cin>>s[i][j];
		}
	}

	sort(all(cs));
	reverse(all(cs));
	vi top(D,1);
	rep(i,0,TOP_NUM){
		top[i]=cs[i].second+1;
	}
	vi notop(D,1);
	rep(i,0,NOTOP_NUM){
		notop[i]=cs[i+TOP_NUM].second+1;
	}

	int cnt=1;
	int nt_idx=0;
	while(1){
		rep(i,0,TOP_NUM){
			cout<<top[i]<<endl;
			cnt++;
			if(cnt>D) return 0;
		}
		rep(i,0,5){
			cout<<notop[nt_idx]<<endl;
			nt_idx++;
			if(nt_idx>=NOTOP_NUM) nt_idx=0;
			cnt++;
			if(cnt>D) return 0;
		}
	}
	return 0;
}


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

string s;
int cnt = 0;

int main() {
  cin >> s;
  for(int i = 0; i < s.size(); ++i)
    if(s[i] == 'o') ++cnt;
  if(cnt + (15 - s.size()) >= 8)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    ab =[]
    a = []
    b = []
    for _ in range(n):
        aa,bb = map(int,input().split())
        ab.append((bb,aa))
        a.append(aa)
        b.append(bb)

    ab.sort()
    now = 0
    for i in range(n):
        now += ab[i][1]
        if now > ab[i][0]:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    main()


Measured memory_bytes: 32708
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	
	string str, s;
	
	int N;
	
	cin >> str;
	
	cin >> N;
	
	int ans = 0;
	
	int d;
	
	for(int i = 0; i < N; i++){
		cin >> s;
		s = s + s.substr(0, 9);
		d = s.find(str, 0);
		if(d != string::npos){
			ans++;
		}
	}
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 1220
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<complex>
#include<algorithm>
#include<vector>
#include<math.h>
#include<set>
#include<map>

int main()
{
	char c1[8], c2[8];
	scanf("%s%s", c1, c2);
	for (int i = 0; i < 3; i++)
	{
		if (c1[i] != c2[2 - i])
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    vector<int> a;
    int b=0;
    for(int i=0;i<12;i++)
    {
        cin>>b;
        a.push_back(b);
        b=0;
    }
    sort(a.begin(),a.end());
    
    if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]&&a[4]==a[5]&&a[5]==a[6]&&a[6]==a[7]&&a[8]==a[9]&&a[9]==a[10]&&a[10]==a[11])
    {
        cout<<"yes"<<endl;
    }
    else
    {
        cout<<"no"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3164
import sys
sys.setrecursionlimit(10**7)

def input(): return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def readInt():return int(input())
def readIntList():return list(map(int,input().split()))
def readStringList():return list(input())
def readStringListWithSpace():return list(input().split())
def readString():return input()

x = readInt()

if x == 0:
    print("1")
elif x == 1:
    print("0")

Measured memory_bytes: 9180
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;

class UF
{
	vector<int> pr;
public:
	UF(int n) {
		pr.resize(n);
		for (int i = 0; i < n; ++i) pr[i] = i;
	}
	int root(int x) {
		if (x == pr[x]) return x;
		else {
			return pr[x] = root(pr[x]);
		}
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return;
		pr[y] = x;
	}
};

int main()
{
	int N, K, L; cin >> N >> K >> L;
	auto uf1 = UF(N);
	auto uf2 = UF(N);
	for (int i = 0; i < K; ++i) {
		int p, q; cin >> p >> q; --p; --q;
		uf1.unite(p, q);
	}
	for (int i = 0; i < L; ++i) {
		int r, s; cin >> r >> s; --r; --s;
		uf2.unite(r, s);
	}
	vector<pair<int, int>> pares(N);
	map<pair<int, int>, int> m;
	for (int i = 0; i < N; ++i) {
		pares[i] = make_pair(uf1.root(i), uf2.root(i));
		++m[pares[i]];
	}
	for (int i = 0; i < N; ++i) {
		cout << m[pares[i]] << ' ';
	}
	return 0;
}




Measured memory_bytes: 14280
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	string str;
	int i, count = 0, max = 0;
    cin >> str;
	
	for(i = 0; i < str.size(); i++){
		if(str[i] != 'A' && str[i] != 'T' && str[i] != 'G' && str[i] != 'C'){
			if(i != 0 && (str[i - 1] == 'A' || str[i - 1] == 'T' || str[i - 1] == 'G' || str[i - 1] == 'C')) max = count;
			count = 0;
		}else{
			count++;
		}
	}
	if(count > max) max = count;
	
	cout << max;
	
	return 0;
}



Measured memory_bytes: 256
n = int(input())

dp = [0 for _ in range(n+1)]

for i in range(1, n+1): # 1円の場合からn円の場合まで繰り返す
    Min = dp[i-1] + 1 # i-1円を引き出してから1円を引き出す場合の引き出し回数の最小値
    j = 1
    while pow(6, j) <= i:
        Min = min(Min, dp[i-pow(6, j)] + 1) # i-6^j円を引き出してから6^j円を引き出す場合の引き出し回数の最小値
        j += 1
    j = 1
    while pow(9, j) <= i:
        Min = min(Min, dp[i-pow(9, j)] + 1) # i-9^j円を引き出してから9^j円を引き出す場合の引き出し回数の最小値
        j += 1
    dp[i] = Min

print(dp[n])

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

int main() {
	int s, s1, s2, s3;
	cin >> s;
	s3 = s % 10;
	s /= 10;
	s2 = s % 10;
	s1 = s / 10;
	cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 504
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n) cout<<fixed<<setprecision(n);
#define rep(i,n)   for (int i = 0; i < (n); ++i)
#define sort(a)    sort((a).begin(), (a).end());
#define uniq(a)    SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define reverse(a) reverse((a).begin(), (a).end());
#define out(d) cout << (d);
#define outl(d) std::cout<<(d)<<"\n";
#define Yes() printf("Yes\n");
#define No() printf("No\n");
#define YES() printf("YES\n");
#define NO() printf("NO\n");
#define ceil(x, y) ((x + y - 1) / (y))

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12)

  double a, b; cin >> a >> b;
  int mi = max(ceil(25 * a, 2), 10 * b);
  int ma = min(25 * (a + 1) / 2, 10 * (b + 1));

  if (mi < ma)
    outl(mi)
  else
    outl(-1)
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class C {
	int n;
	int n4{ 0 }, n2{ 0 }, no{ 0 };
public:
	C()
	{

		cin >> n;

		REP(i, n)
		{
			int tmp;
			cin >> tmp;

			if (tmp & 1)
				no++;
			else if (!(tmp & 0b11))
				n4++;
			else
				n2++;

		}
	}

	void solve()
	{
		if (no)
		{
			if (!n2)
			{
				if (no <= n4 + 1)
				{
					cout << "Yes" << endl;
					return;
				}
				cout << "No" << endl;
				return;
			}

			else
			{
				if (no <= n4)
				{
					cout << "Yes" << endl;
					return;
				}

				cout << "No" << endl;
				return;
			}
		}

		else
		{
			if (n2 == 1 && !n4)
			{
				cout << "No" << endl;
				return;
			}
		}

		cout << "Yes" << endl;


	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string s;

  cin >> s;

if ( s [0]== s [1]&& s [1]== s [2]) puts (" Yes ");
else if ( s [1]== s [2]&& s [2]== s [3]) puts (" Yes ");
else puts (" No ");
 
}


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

#ifdef DEBUG
#define LOG(...) fprintf(stderr, __VA_ARGS__)
#else
#define LOG(...) 
#endif // DEBUG

#define MAX_VERTEX_NUM 50

int main(void)
{
    int count = 1;
    while (1) {
        int num;
        int x[MAX_VERTEX_NUM], y[MAX_VERTEX_NUM];
        int i;
        double result = 0;
        
        scanf("%d\n", &num);
        LOG("num = %d\n", num);

        if (num == 0) {
            break;
        }

        if (num < 2 || num > MAX_VERTEX_NUM) {
            break;
        }
        
        scanf("%d %d\n", &x[0], &y[0]);
        LOG("x[0] = %d, y[0] = %d\n",  x[0],  y[0]);
        for (i = 1; i <= num; i++) {
            if (i == num) {
                result = result + (x[i-1] * y[0] - x[0] * y[i-1]);
                LOG("result= %f\n", result);
            }
            else {
                scanf("%d %d\n", &x[i], &y[i]);
                LOG("x[%d] = %d, y[%d] = %d\n", i, x[i], i, y[i]);
                result = result + (x[i-1] * y[i] - x[i] * y[i-1]);
                LOG("result= %f\n", result);
            }
        }
        scanf("\n");
        printf("%d %.1f\n", count, fabs(result / 2));
        count++;
                
    }
    
    return 0;
}

Measured memory_bytes: 640
#include"bits/stdc++.h"
using namespace std;
struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0);cout<<fixed<<setprecision(10); } } ___;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
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 pii pair<int,int>
#define ff first
#define ss second
#define endll '\n'
#define rep(i,n) for(int i=0;i++<n;)
#define scl(i) scanf("%lld",&i);

using ll = long long int;
using intt = long long int;

int main()
{
    ll k,a,b;cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
}


Measured memory_bytes: 3652
#include<stdio.h>
int main()
{
  int s1,s2,i,mx;
  char a;
  while(1){ 
 mx=0;
  for(i=0;i<5;i++){
    scanf("%d%d",&s1,&s2);
    if(i==0&&s1==0&&s2==0)break;
    if(s1+s2>mx){
      mx=s1+s2;
      if(i==0)a='A';
      if(i==1)a='B';
      if(i==2)a='C';
      if(i==3)a='D';
      if(i==4)a='E';
  }
  }
   if(i==0&&s1==0&&s2==0)break;
    printf("%c %d\n",a,mx);
  }
    return 0;
  }

Measured memory_bytes: 596
#include <stdio.h>

int main(void) {
    int N;

    scanf("%d", &N);

    switch(N % 10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            printf("hon\n");
            return 0;
        case 0:
        case 1:
        case 6:
        case 8:
            printf("pon\n");
            return 0;
        case 3:
            printf("bon\n");
            return 0;
    }

    return 0;
}


Measured memory_bytes: 1620
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    K,X = mi()
    Z = list(range(2000001))

    x = X
    ans = set()
    for i in range(K):
        y1 = x + i 
        y2 = x - i

        for y in [y1,y2]:
            y += 1000000
            if 0<= y < len(Z):
                ans.add(y-1000000)

    ans = list(ans)
    ans.sort()

    print(*ans,sep=" ")





if __name__ == "__main__":
    main()

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

int gcd(int a,int b){
  int c=max(a,b),d=min(a,b);
  int v;
  v=c%d;
  if(v==0){
    return d;
  }else{
    c=d;
    d=v;
    return gcd(c,d);
  }
}

  int main(){
    int n,x,y[1000000],z[1000000];
    cin >> n >> x;
    FOR(i,n){
      cin >> y[i];
    }
    y[n]=x;
    sort(y,y+n+1);
    FOR(i,n){
      z[i]=y[i+1]-y[i];
    }
    int v=z[0];
    FOR(i,n){
      v=gcd(v,z[i]);
    }
    cout << v << endl;
  }

Measured memory_bytes: 4608
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        N: usize,
        K: usize,
    }
    if K == 0 {
        println!("{}", N * N);
        return;
    }
    use std::cmp::min;
    let mut ans = 0;
    for b in (K+1)..(N+1) {
        // 余りは K, K+1, ..., b-1 のいずれか
        let mut bottom = K;
        let mut cnt = 0;
        while bottom <= N {
            cnt += min(N, bottom + (b - 1 - K)) - bottom + 1;
            bottom += b;
        }
        ans += cnt;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>

void selectionSort(int *array, int len)
{
	for (int i = 0; i < len - 1; i++)
	{
		int min = i;
		for (int j = i + 1; j < len; j++)
		{
			if (array[j] < array[min])min = j;
		}
		int temp;
		temp = array[i];
		array[i] = array[min];
		array[min] = temp;
	}
}

int main()
{
	int a[3];
	scanf("%d %d %d", a, a + 1, a + 2);

	selectionSort(a, 3);
	printf("%d %d %d\n", a[0], a[1], a[2]);
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var S = Read();
            var dict = new Dictionary<string, int>
            {
                {"SUN", 7 },
                {"MON", 1 },
                {"TUE", 2 },
                {"WED", 3 },
                {"THU", 4 },
                {"FRI", 5 },
                {"SAT", 6 }
            };

            if (S == "SUN") Println(7);
            else Println(dict["SUN"] - dict[S]);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 13152
import queue

# ['1', '0'] => 10 関数 
def strtoNum(l):
    val = ''
    for _ in l:
        val += _
    return int(val)

# 入力
k = int(input())

# k < 10だけ別対応しておく
if k < 10:
    print(k)
    exit()

# ルンルン数を管理するキュー
lun = queue.Queue()
# 初期値として1~9を入れておく
for i in range(1, 10):
    lun.put(i)

# 10からスタートなので、既にルンルンカウントを9にしておく
cnt = 9
# 0~
apdNum = [[0,1],[0,1,2],[1,2,3],[2,3,4],[3,4,5],[4,5,6],[5,6,7],[6,7,8],[7,8,9],[8,9]]

while not lun.empty():
    # dequeueした数を取得
    getNum = list(str(lun.get()))
    # 一番最後の桁だけを確認する
    chkNum = int(getNum[len(getNum)-1])
    for i in apdNum[chkNum]:
        cnt += 1
        putNum = getNum + [str(i)]
        if cnt == k:
            print(strtoNum(putNum))
            exit()
        else:
            lun.put(strtoNum(putNum))


Measured memory_bytes: 6484
#include<bits/stdc++.h>
using namespace std;
int n, x[100005];
char a[100005];
bool f;

int main()
{
	scanf("%d%s",&n,a+1);
	for(int i=1;i<=n;i++) {
		a[i] = (a[i] == 'x');
	}
	for(x[1] = 0; !f && x[1] < 2; x[1]++) for(x[2] = 0; !f && x[2] < 2; x[2]++) {
		for(int i=3;i<=n;i++) x[i] = a[i-1] ^ x[i-1] ^ x[i-2];
		if((x[n]^x[1]^x[2]) == a[1] && (x[n-1]^x[n]^x[1]) == a[n]) {
			for(int i=1;i<=n;i++) putchar(x[i] ? 'W' : 'S');
			f = true;
		}
	}
	if(!f) printf("-1");
	puts("");
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
using ll = long long;
int main() {
    int n;
    scanf("%d", &n);

    ll m = 0, a = 0, r = 0, c = 0, h = 0;  // それぞれの頭文字を持つ人の数
    string s;
    rep(i, n){
        cin >> s;
        if (s[0] == 'M') m++;
        if (s[0] == 'A') a++;
        if (s[0] == 'R') r++;
        if (s[0] == 'C') c++;
        if (s[0] == 'H') h++;
    }

    ll D[5]; //各アルファベットを頭文字荷物名前の個数を入れた配列
    D[0] = m, D[1] = a, D[2] = r, D[3] = c, D[4] = h;

    // 組み合わせ（縦に見ると分かりやすい）。制約から重複がないことが前提。
    int P[10] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 2};
    int Q[10] = {1, 1, 1, 2, 2, 3, 2, 2, 3, 3};
    int R[10] = {2, 3, 4, 3, 4, 4, 3, 4, 4, 4};

    ll res = 0;
    rep(d, 10) res += D[P[d]] * D[Q[d]] * D[R[d]];
    printf("%lld\n ", res);
}

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

int main(){
	int a,b;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){break;}
		if(a<b)swap(a,b);

		int count=0;
		while(b!=0){
		a=a%b;
		swap(a,b);
		count++;

		}
	cout<<a<<" "<<count<<endl;
	}
	return 0;
}


Measured memory_bytes: 2992
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;
typedef long long ll;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string s;cin>>s;
    ll K;cin>>K;
    int N = s.size();
    //'a'との距離
    vector<int> v(N,0);
    rep(i,N){
        v[i] = 'z'-s[i]+1;
        if(s[i] == 'a')v[i] = 0;
    }
    print(v);
    rep(i,N){
        if(v[i]<=K){
            K-=v[i];
            v[i] = 0;
        }
    }
    print(v);
    cerr<<K<<endl;
    K%=26;
    bool flag = true;
    for (int i = N-1; i >= 0; --i){
        if(v[i]>0){
            v[i] -=K;
            flag = false;
            break;
        }
    }
    //全部'a'になっているということ
    if(flag){
        v[N-1] +=26-K;
    }
    print(v);
    string T = "";
    rep(i,N){
        if(v[i] == 0){
            T.push_back('a');
        }
        else{
            T.push_back(char('z'-v[i]+1));
        }
    }
    cout<<T<<endl;
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test int t;cin>>t;while(t--)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define MOD 1000000007
#define ll long long
#define ld long double
#define int ll
#define pb push_back
#define ii pair<int,int>
#define llll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<ii>
#define vllll vector<llll>
#define ff first
#define ss second
#define INF 1000000000
#define HINF 1000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define arrin(x,n) int x[n]; for(int o=0;o<n;o++) cin>>x[o]
#define arrout(x,n) for(int o=0;o<n;o++) cout<<x[o]<<" "; cout<<endl
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<'='<<x<<endl
#define deb2(x,y) cout<<#x<<'='<<x<<" "<<#y<<'='<<y<<endl
#define deb3(x,y,z) cout<<#x<<'='<<x<<" "<<#y<<'='<<y<<" "<<#z<<'='<<z<<endl
#define debarr(arr,n) for(int o=0;o<n;o++) deb2(o,arr[o])
#define IO freopen("input.txt", "r", stdin); freopen("output.txt", "w+", stdout)
const double pi = 3.14159265358979323846;

ll power(ll a, ll b){//a^b
    ll res=1;
    //a=a%MOD;
    while(b>0){
        if(b&1)
		{res=(res*a);
		//res%=MOD;
		b--;}
        a=(a*a);
        //a%=MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int C(int n,int k)
{
	int ans=1;
	if(k>n-k)
	k=n-k;
	for(int i=1;i<=k;i++)
	ans*=(n-i+1),ans/=i;
	return ans;
}

void solve()
{

	int i=0,j=0,k=0,m,n,p,sum=0,cnt=0;
	string s;
	cin>>s;
	if(s=="SSS")
	{
	    cout<<0;
	    return;
	}
	if(s=="RSS" or s=="SRS" or s=="SSR" or s=="RSR")
	{
	    cout<<1;
	    return;
	}
	if(s=="RRS" or s=="SRR")
	cout<<2;
	else cout<<3;
}
int32_t main() {
    fast
    //IO;
	//cout<<fixed<<setprecision(6);
    //test
    {
        
        solve();
		
		      
    }
    return 0;
}
  

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    set<int> s;
    rep(i,n) {
        int a;
        cin >> a;
        s.insert(a);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define MAXN 50
int n,cnt;
int a[MAXN],b[MAXN];
inline int read(){
	int x=0,t=1,c;
	while(!isdigit(c=getchar())) if(c=='-') t=-1;
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	return x*t;
}
int main(){
	n=read();
	for(int i=1;i<=n;i++) a[i]=read(),b[i]=max(b[i-1],a[i-1]);
	for(int i=1;i<=n;i++) if(b[i]<=a[i]) cnt++;
	printf("%d\n",cnt);
	return 0;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  long long r = 0, g = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R') r++;
    else if (s[i] == 'G') g++;
    else if (s[i] == 'B') b++;
  }
  
  int cnt = 0;
  
  for (int i = 0; i <= n-3; i++) {
    for (int j = i+1; j <= n-2; j++) {
      int k = j + j-i;
      if (k >= n) break;
      if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) cnt++;
    }
  }
  
  cout << r*g*b - cnt;
  
  return 0;
}

Measured memory_bytes: 3632
# coding: utf-8
# Your code here!

N = int(input())
A = [0 for _ in range(N)]
B = list(map(int,input().split()))
A[0] = B[0]

for i in range(1, N - 1):
    A[i] = min(B[i - 1], B[i])
    
A[-1] = B[-1]

print(sum(A))

Measured memory_bytes: 3064
N = int(input())
A = sorted([int(a) for a in input().split()])
X = [0] * 1001
for a in A:
    X[a] += 1
for i in range(1, 1001):
    X[i] += X[i-1]

ans = 0
for i in range(N):
    for j in range(i+1, N):
        ans += X[min(A[i]+A[j]-1, 1000)] - (j+1)
print(ans)

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

int main(void) {
	int N;
	cin >> N;
	bool ok = false;

	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			if (N == 7 * 100 + i * 10 + j) {
				ok = true;
				break;
			}
			else if (N == i * 100 + 7 * 10 + j) {
				ok = true;
				break;
			}
			else if (N == i * 100 + j * 10 + 7) {
				ok = true;
				break;
			}
		}
	}
	if (ok == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3632
n = int(input())
arr = []
for i in range(n):
    arr.append(list(map(int , input().split())))
dp = [[0 for j in range(3)] for i in range(n + 2)]
for i in range(1 , n + 1):
    dp[i][0] = arr[i - 1][0] + max(dp[i - 1][1] , dp[i - 1][2])
    dp[i][1] = arr[i - 1][1] + max(dp[i - 1][0] , dp[i - 1][2])
    dp[i][2] = arr[i - 1][2] + max(dp[i - 1][0] , dp[i - 1][1])
print(max(dp[n]))

Measured memory_bytes: 50024
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
#include<math.h>
//#include "Ants.h"
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef pair < int, int> P;
/****Union-Ford-Tree***/
int par[int(0x7ffffff)];//Parent
int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;


//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}
/************************************************************************************/
int dx[4] = { 1,0/*,-1,0*/ }, dy[4] = { 0,1/*,0,-1*/ };
/**************/

typedef long double ld;
typedef unsigned long long ull;
const int MX = 3007;

ld f[MX][MX], p[MX];

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> p[i];
	f[0][0] = 1.0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			f[i + 1][j + 1] += f[i][j] * p[i];
			f[i + 1][j] += f[i][j]*(1.0-p[i]);
		}
	}
	ld ans = 0.0;
	for (int i = 0; i <= n; i++) {
		if (n<= i*2 ) {
			ans += f[n][i];
		}
	}
	cout.precision(20);
	cout << fixed << ans << endl;
	return 0;
}


Measured memory_bytes: 141568
#include <stdio.h>
int k, x, y, e;
int main() {
	scanf("%d%d", &k, &x);
	for (int i = -1000000; i <= 1000000; i++) {
		y = i - x;
		if (x - i > y)y = x - i;
		if (k - y > 0) {
			if (e)printf(" %d", i);
			else printf("%d", i);
			e = 1;
		}
	}
	printf("\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, X, Y; cin >> N >> X >> Y;
    X--; Y--;
    vector<vector<int>> dist(N, vector<int>(N));
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            dist[i][j] = min(j-i, abs(X - i) + 1 + abs(j - Y));
        }
    }

    vector<int> ans(N, 0);
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            ans[dist[i][j]]++;
        }
    }

    for (int i = 1; i < N; i++)
    {
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s[3];
  int n[3];
  REP(i, 3) cin >> s[i], n[i] = s[i].size();
  int now = 0;
  int i[] = {0, 0, 0};
  while(i[now] != n[now]){
    int j = i[now]++;
    if(s[now][j] == 'a'){
      now = 0;
    }else if(s[now][j] == 'b'){
      now = 1;
    }else{
      now = 2;
    }
  }
  if(now == 0) cout << 'A' << endl;
  else if(now == 1) cout << 'B' << endl;
  else cout << 'C' << endl;
  return 0;
}

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

int main()
{
	int a,b,c,x;
  	cin>>a>>b>>c>>x;
  	map<pair<int,pair<int,int> >,int> count; 
  	for(int i=c ; i>=0 ; --i)
    {
        int fifty=i*50;
    	//cout<<"i "<<i<<" "<<ans<<" "<<fifty<<" "<<x<<endl;
    	if(fifty>x)
        continue;
        if(fifty==x)
        count[{0,{0,i}}]=1;
      	for(int j=b; j>=0 ; --j)
        {
          	int hundred=j*100;
          	int fifty_plus_hundred=fifty+hundred;
            if(hundred>x || fifty_plus_hundred>x)
            continue;
            if(hundred==x)
            count[{0,{j,0}}]=1;
            if(fifty_plus_hundred==x)
            count[{0,{j,i}}]=1;
        	for(int k=a ; k>0 ; --k)
            {
            	int five_hundred=k*500;
              	int five_hundred_plus_fifty_plus_hundred=five_hundred+fifty_plus_hundred;
                if(five_hundred==x)                
                count[{k,{0,0}}]=1;
                if(five_hundred_plus_fifty_plus_hundred==x)
                count[{k,{j,i}}]=1;
            }
        }
    }
  	cout<<count.size()<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  double sum = 0;
  cin >> N;
 
  vector<int> A(N); // A個の整数
 
  // 整数を受け取る
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
    //逆数の総和を求める
    for (int i = 0; i < N; i++) {
       // 小数点以下10桁まで
      sum = sum + 1 / (double)A.at(i);
  }
  
  // 逆数の総和の総和を出力
  cout << fixed << setprecision(10);
  cout << 1 / sum << endl;
 }

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

int main(){
  int N, i, j, t=0, tmp;
  int A[100];

  scanf("%d",&N);
  if( N<0 || 100<N ) exit(1);

  for( i=0 ; i<N ; i++ ){
    scanf("%d",&A[i]);
    if( A[i]<0 || 100<A[i] ) exit(2);
  }

  for( i=0 ; i<N ; i++ ){
    for( j=N-1 ; i<j ; j-- ){
      if( A[j]<A[j-1] ){
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
	t++;
      }
    }
  }

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

Measured memory_bytes: 600
//https://atcoder.jp/contests/code-festival-2017-qualc/tasks/code_festival_2017_qualc_c
//C - Inserting 'x'
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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 main() {
    string s; cin>>s;
    string s_delx;
    for(const auto& c:s){
        if(c!='x') s_delx.push_back(c);
    }
    string s_rev=s_delx;
    reverse(s_rev.begin(),s_rev.end());
    if(s_rev!=s_delx) {cout<<-1<<endl; return 0;} //無理
    ll l=0,r=s.size()-1;
    ll ans=0;
    while(l<r){
        if(s.at(l)!=s.at(r)){
            if(s.at(l)!='x'){
                ++ans;
                --r;
            } else if(s.at(r)!='x'){
                ++ans;
                ++l;
            }else{
                assert(0);
            }
        }else{
            ++l;
            --r;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define MOD ((ll)1000000007)


int main(int argc, char const *argv[])
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	int N;
    vector<string> s(N);
	cin >> N;
    string ts;
    for (int i = 0; i < N; i++)
    {
        cin >> ts;
        sort(ts.begin(), ts.end());
        s.push_back(ts);
    }
    ll total=0;
    unordered_map<string, int> m;
    sort(s.begin(), s.end());
    int i;
    for (i = 0; i < N; i++)
    {
       if (m.count(s[i]) == 0) {
           m[s[i]] = 1;
       } else {

           total += m[s[i]];
           m[s[i]]++;
       }
    }
    cout << total << endl;
	return 0;
}


Measured memory_bytes: 9712
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
using namespace std;

string s;

inline void work(){
	cin >> s;
	REP(i, 0, s.size() - 1)
		if (s[i] == '7'){
			puts("Yes");
			exit(0);
		}
	puts("No");
}

int main(){
	work();
	return 0;
}

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

int main(){
  int N;
  int a[110];
  cin >> N;
  for(int i = 0; i < N; ++i) cin >> a[i];
  sort(a, a + N);
  cout << a[N - 1] - a[0] << endl;
}


Measured memory_bytes: 256
import heapq
def dijkstra(S, N, Edge):
    # S: start vertex
    # N: number of vertices
    # Edge: adjacent list [node, cost]
    
    INF = 10**20
    dist = [INF]*N
    dist[S] = 0
    que = [(0, S)]
    heapq.heapify(que)
    
    while que:
        c, v = heapq.heappop(que)
        if dist[v] < c: continue

        for nv, nc in Edge[v]:
            if c+nc < dist[nv]:
                dist[nv] = c+nc
                heapq.heappush(que, (c+nc, nv))
    
    return dist


import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N,X,Y = map(int,input().split())
edge = [[] for _ in range(N)]
for i in range(N-1):
    edge[i].append((i+1,1))
    edge[i+1].append((i,1))
edge[X-1].append((Y-1,1))
edge[Y-1].append((X-1,1))

ans = [0]*N
for i in range(N):
    dist = dijkstra(i, N, edge)
    for j in range(i+1,N):
        ans[dist[j]] += 1
for k in ans[1:]:
    print(k)




Measured memory_bytes: 89180
input_words=Hash.new(0)
stg_w =gets.chomp.split("")

stg_w.each do |stg|
  input_words[stg]+=1
end

x=0
input_words.each do |key,value|
 if value % 2 ==0
   x+=0
 else
   x+=1
 end
end

if x==0
  print "Yes"
else x!=0
  print "No"
end


Measured memory_bytes: 1788
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;
const int oo = 1e8+7;


int main() {
    
    int n;
    scanf("%d",&n);
    
    vector<double> p;
    p.push_back(1.0);
    
    for(int i = 0; i < n; ++i) {
        
        double pp;
        scanf("%lf",&pp);
        
        p.push_back(0.0);
        
        for(int j = i; j >= 0; --j) {
            
            p[j+1] += p[j] * pp;
            p[j] *= (1.0 - pp);
        }
    }

    double ans = 0.0;
    
    for(int i = 0; i <= n; ++i) {
        int heads = i;
        int tails = n-heads;
        
        if(heads > tails) {
            ans += p[heads];
        }
    }
    
    printf("%.10lf\n", ans);
    
    return 0;
}




Measured memory_bytes: 256
#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 n;
	cin >> n;
	string s;
	cin >> s;
	string t;
	for (int i = 0; i < s.length(); i++) {
		int a = s[i] - 'A';
		a += n;
		a %= 26;

		t += ('A' + a);
	}
	cout << t << endl;
	
}


Measured memory_bytes: 3640
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;


/* ソート済みの配列について、
   オブジェクトとその個数を得る。
*/
template<typename Itr, typename Fn>
void counting(Itr b, Itr e, Fn f) {
    if (b == e) {
        // no element;
        return;
    }
    size_t count = 0;
    auto&& itr = b;
    for (; itr + 1 != e; ++itr) {
        count++;
        if (*itr != *(itr + 1)) {
            f(*itr, count);
            count = 0;
        }
    }

    f(*itr, ++count);
}

int main()
{
    int64_t H, W, N;
    std::cin >> H >> W >> N;

    struct Pos {
        int64_t x;
        int64_t y;

        bool operator<(const Pos& rhs) const
        {
            return x == rhs.x ? y < rhs.y : x < rhs.x;
        }

        bool operator!=(const Pos& rhs) const
        {
            return x != rhs.x ||  y != rhs.y;
        }
    };

    std::vector<Pos> V;

    for (decltype(N) i = 0; i < N; ++i) {
        Pos p;
        std::cin >> p.y >> p.x;
        p.y --;
        p.x --;
        for (int64_t y = -1; y <= 1; ++y) {
            for (int64_t x = -1; x <= 1; ++x) {
                auto xx = p.x + x;
                auto yy = p.y + y;
                if (1 <= xx && xx < W-1&& 1 <= yy && yy < H-1) {
                    V.push_back(Pos{xx, yy});
                }
            }
        }
    }

    std::sort(std::begin(V), std::end(V));

    std::vector<int64_t> ret;
    ret.resize(10);
    ret[0] = (H-2)*(W-2);

    counting(V.begin(), V.end(), [&ret](const auto& elem, size_t count) {
            ret[count] ++;
            ret[0] --;
        });

    for (size_t i = 0; i <= 9; ++i) {
        std::cout << ret[i] << std::endl;
    }

    return 0;
}


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

int main(){
	int i, ans = 0;
	string S;
	cin >> S;
	int N = S.size();
	for(i = 0; i < N; i++){
		if(i < N - 1 - i && S[i] != S[N - 1 - i]){
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
// 木の直径
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 100000

const int WHITE = 0;// 未訪問
const int GRAY = 1; // 訪問中
const int BLACK = 2;// 訪問完了

const int INV = -1;

typedef struct
{
    int end;
    int weight;
}DATA;

// 木の情報を保持する動的配列
vector<DATA> G[MAX_N];

// 各頂点の訪問状態を保持する配列
int color[MAX_N + 1];

// 頂点:0から一番離れた頂点のNo.
int Zero_Leave_V = -1;
// 頂点間の最大距離
int Max_Distance = -1;

int N;

void depthFirstSearch(int now_v, int distance);

int main(void)
{
    int start;
    DATA ele;

    cin >> N;

    // 配列の初期化
    for(int i = 0; i < N + 1; i++)
    {
        color[i] = WHITE;
    }

    for(int i = 0; i < N - 1; i++)
    {
        cin >> start >> ele.end >> ele.weight;

        G[start].push_back(ele);
        // 双方向に設定する
        swap(start, ele.end);
        G[start].push_back(ele);
    }

    // 頂点:0 から最も離れた点を求める
    depthFirstSearch(0, 0);

    // 訪問情報の初期化
    for(int i = 0; i < N + 1; i++)
    {
        color[i] = WHITE;
    }

    Max_Distance = -1;

    // Zero_Leave_V から, 最も離れた点との距離を求める
    depthFirstSearch(Zero_Leave_V, 0);

    cout << Max_Distance << endl;

    return 0;
}

// 深さ優先探索を実施する関数
// now_vertex : 現在の頂点のNo.
// distance : 現在までの距離
void depthFirstSearch(int now_v, int distance)
{

    int end, mid_distance;

    // 訪問中を設定
    color[now_v] = GRAY;

    for(unsigned int i = 0; i < G[now_v].size(); i++)
    {
        end = G[now_v][i].end;

        if( color[end] == WHITE )
        {
            // 距離の計算
        	mid_distance = distance;
        	mid_distance += G[now_v][i].weight;

            // 未訪問の頂点が存在する時は再帰的に関数コールする
            depthFirstSearch(end, mid_distance);
        }
    }

    // 訪問完了
    color[now_v] = BLACK;

    if( Max_Distance < distance )
    {
        //距離が最大となる頂点と距離の値を保存する
        Zero_Leave_V = now_v;
        Max_Distance = distance;
    }

    return;
}



Measured memory_bytes: 13632
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)

int min(int a,int b){return (a>b)? b:a;}
int main (){
	int NN,MM,tempa,tempb,ans=1;
	cin >> NN >> MM;
	int tt[NN+1];
	// 一番狭い区間のデータだけとっておきたいので、終端をメモる配置に適当にでかい値を予め入れておく
	rep(i,NN+1){tt[i] = 100000000;}
	rep(i,MM){
		cin >> tempa >> tempb;
		tt[tempa] = min(tt[min(tempa,tempb)],(-1)*min(-1*tempb,-1*tempa));
	}
	vector <pair <int ,int > > ttt;
	rep(i,NN)if(tt[i]!=100000000)ttt.push_back(make_pair(i,tt[i]));
	int ff = ttt[0].first;
	int fb = ttt[0].second;
	rep(i,ttt.size()){
		if( fb <= ttt[i].first ){ff = ttt[i].first;fb = ttt[i].second;ans ++;}
		if( fb > ttt[i].second ){fb = ttt[i].second;}
	}
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 1784
#include <cstdio>
#include <bitset>
using namespace std;
bitset<2000 * 2000 + 5 > B;
int N;
int main()
{
    B[0] = 1;
    scanf("%d",&N);
    int sum = 0;
    while(N--){
        int val;
        scanf("%d",&val);
        sum += val;
        B = B | (B << val);
    }
    int val = (sum + 1)/ 2;
    while(!B[val]){
        val++;
    }
    printf("%d",val);
    return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first 
#define se second
#define pi pair<ll,ll> 
#define pb push_back
#define mk make_pair
ll a[50],b[50],c[50],d[50],e[50];
ll n,m,q;
ll res=0;
void dfs(int pos , int val){
	if(pos==n){
		ll ans=0;
		for(int i=0;i<q;i++){
			 if(e[b[i]]-e[a[i]]==c[i]){
				 ans+=d[i];
			 }
		 }
		 res=max(res,ans);
		 return ;
	}
	for(int i=val;i<=m;i++){
		e[pos]=i;
		dfs(pos+1,i);
	}
} 
int main(){ 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin>>n>>m>>q;
  for(int i=0;i<q;i++){
	  cin>>a[i]>>b[i]>>c[i]>>d[i];
	  a[i]--;
	  b[i]--;
  }
  dfs(0,1);
  cout<<res<<endl;
}


Measured memory_bytes: 3676